tango-app-api-trax 3.8.15 → 3.8.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-trax",
3
- "version": "3.8.15",
3
+ "version": "3.8.16",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -3412,7 +3412,16 @@ export async function getStoreTaskDetails( req, res ) {
3412
3412
 
3413
3413
  export async function runAIFlag( req, res ) {
3414
3414
  try {
3415
- let checklistDetails = await CLconfig.find( { publish: true, $expr: { $ne: [ { $size: '$notifyFlags.notifyType' }, 0 ] }, runAIQuestionCount: { $ne: 0 } }, { _id: 1, notifyFlags: 1, approver: 1 } );
3415
+ let checklistDetails = await CLconfig.find( {
3416
+ publish: true,
3417
+ runAIQuestionCount: { $ne: 0 },
3418
+ $expr: {
3419
+ $gt: [
3420
+ { $size: { $cond: [ { $isArray: '$notifyFlags.notifyType' }, '$notifyFlags.notifyType', [] ] } },
3421
+ 0,
3422
+ ],
3423
+ },
3424
+ }, { _id: 1, notifyFlags: 1, approver: 1 } );
3416
3425
  let date = dayjs().subtract( 1, 'day' ).format( 'YYYY-MM-DD' );
3417
3426
  if ( checklistDetails.length ) {
3418
3427
  await Promise.all( checklistDetails.map( async ( ele ) => {
@@ -3422,7 +3431,7 @@ export async function runAIFlag( req, res ) {
3422
3431
  let runAIFlag = 0;
3423
3432
  store.questionAnswers.forEach( ( section ) => {
3424
3433
  section.questions.forEach( ( question ) => {
3425
- if ( question.answerType == 'image' && ( question?.userAnswer?.[0]?.runAIData.value == 'False' || !question?.userAnswer?.[0]?.runAIData.value ) ) {
3434
+ if ( question.answerType == 'image' && ( question?.userAnswer?.[0]?.runAIData?.value == 'False' || !question?.userAnswer?.[0]?.runAIData?.value ) ) {
3426
3435
  runAIFlag++;
3427
3436
  }
3428
3437
  } );
@@ -196,8 +196,8 @@
196
196
  {{!-- <span class="q-ans {{#if this.isYes}}ans-yes{{else}}{{#if this.isNo}}ans-no{{/if}}{{/if}}">{{#if this.isYes}}✓ Yes{{else}}{{#if this.isNo}}✗ No{{else}}{{this.answerDisplay}}{{/if}}{{/if}}</span> --}}
197
197
  {{#if this.userAnswer.length}}
198
198
  <div class="q-answer-list">
199
+ {{!-- text/video answers render per userAnswer above the table --}}
199
200
  {{#each this.userAnswer}}
200
- <div class="q-answer-item">
201
201
  {{#eq this.answerType 'text'}}
202
202
  {{#if this.answer}}
203
203
  <div class="q-answer-text {{#if this.sopFlag}}flagged{{/if}}">{{this.answer}}</div>
@@ -211,62 +211,64 @@
211
211
  </div>
212
212
  {{/if}}
213
213
  {{/eq}}
214
+ {{/each}}
214
215
 
215
- <table style="width:100%;margin-top:8px"><tr>
216
- {{#if this.multiReferenceImage.length}}
217
- <td style="width:50%;vertical-align:top;padding-right:8px">
218
- <div class="q-answer-caption">Reference Image</div>
219
- {{#each this.multiReferenceImage}}
220
- <img src="{{this}}" alt="Reference Image" />
221
- {{/each}}
222
- </td>
223
- {{/if}}
224
- {{#unless this.multiReferenceImage.length}}
225
- {{#if this.referenceImage}}
226
- <td style="width:50%;vertical-align:top;padding-right:8px">
227
- <div class="q-answer-caption">Reference Image</div>
228
- <img src="{{this.referenceImage}}" alt="Reference Image" />
229
- </td>
230
- {{/if}}
231
- {{/unless}}
232
- <td style="vertical-align:top">
233
- {{#eq this.answerType 'image'}}
234
- {{#if this.answer}}
235
- <div class="q-answer-caption">Uploaded Image</div>
236
- <img src="{{this.answer}}" alt="Uploaded Image" />
216
+ {{!-- Single 50/50 table per question: references rendered once on the left,
217
+ all uploaded/validation images stacked on the right --}}
218
+ <table style="width:100%;margin-top:8px"><tr>
219
+ {{#if this.userAnswer.[0].multiReferenceImage.length}}
220
+ <td style="width:50%;vertical-align:top;padding-right:8px">
221
+ <div class="q-answer-caption">Reference Image</div>
222
+ {{#each this.userAnswer.[0].multiReferenceImage}}
223
+ <img src="{{this}}" alt="Reference Image" />
224
+ {{/each}}
225
+ </td>
226
+ {{else}}
227
+ {{#if this.userAnswer.[0].referenceImage}}
228
+ <td style="width:50%;vertical-align:top;padding-right:8px">
229
+ <div class="q-answer-caption">Reference Image</div>
230
+ <img src="{{this.userAnswer.[0].referenceImage}}" alt="Reference Image" />
231
+ </td>
232
+ {{/if}}
233
+ {{/if}}
234
+ <td style="vertical-align:top">
235
+ {{#each this.userAnswer}}
236
+ {{#eq this.answerType 'image'}}
237
+ {{#if this.answer}}
238
+ <div class="q-answer-caption">Uploaded Image</div>
239
+ <img src="{{this.answer}}" alt="Uploaded Image" />
240
+ {{/if}}
241
+ {{/eq}}
242
+ {{#if this.validation}}
243
+ {{#eq this.validationDisplayType 'image'}}
244
+ {{#if this.validationAnswer}}
245
+ <div class="q-answer-caption">Validation Image</div>
246
+ <img src="{{this.validationAnswer}}" alt="Validation Image" />
237
247
  {{/if}}
238
248
  {{/eq}}
239
- {{#if this.validation}}
240
- {{#eq this.validationDisplayType 'image'}}
241
- {{#if this.validationAnswer}}
242
- <div class="q-answer-caption">Validation Image</div>
243
- <img src="{{this.validationAnswer}}" alt="Validation Image" />
244
- {{/if}}
245
- {{/eq}}
246
- {{#eq this.validationDisplayType 'video'}}
247
- {{#if this.validationAnswer}}
248
- <div class="q-answer-caption">Validation Video</div>
249
- <a class="q-answer-link" href="{{this.validationAnswer}}" target="_blank">{{this.validationAnswer}}</a>
250
- {{/if}}
251
- {{/eq}}
252
- {{#eq this.validationDisplayType 'text'}}
253
- {{#if this.validationAnswer}}
254
- <div class="q-answer-text">{{this.validationAnswer}}</div>
255
- {{/if}}
256
- {{/eq}}
257
- {{#eq this.validationDisplayType 'multiImage'}}
258
- {{#if this.validationImage.length}}
259
- <div class="q-answer-caption">Validation Image</div>
260
- {{#each this.validationImage}}
261
- <img src="{{this}}" alt="Validation Image" />
262
- {{/each}}
263
- {{/if}}
264
- {{/eq}}
265
- {{/if}}
266
- </td>
267
- </tr></table>
268
- </div>
269
- {{/each}}
249
+ {{#eq this.validationDisplayType 'video'}}
250
+ {{#if this.validationAnswer}}
251
+ <div class="q-answer-caption">Validation Video</div>
252
+ <a class="q-answer-link" href="{{this.validationAnswer}}" target="_blank">{{this.validationAnswer}}</a>
253
+ {{/if}}
254
+ {{/eq}}
255
+ {{#eq this.validationDisplayType 'text'}}
256
+ {{#if this.validationAnswer}}
257
+ <div class="q-answer-text">{{this.validationAnswer}}</div>
258
+ {{/if}}
259
+ {{/eq}}
260
+ {{#eq this.validationDisplayType 'multiImage'}}
261
+ {{#if this.validationImage.length}}
262
+ <div class="q-answer-caption">Validation Image</div>
263
+ {{#each this.validationImage}}
264
+ <img src="{{this}}" alt="Validation Image" />
265
+ {{/each}}
266
+ {{/if}}
267
+ {{/eq}}
268
+ {{/if}}
269
+ {{/each}}
270
+ </td>
271
+ </tr></table>
270
272
  </div>
271
273
  {{/if}}
272
274
  {{#if this.remarks}}