tango-app-api-trax 3.8.27 → 3.8.29

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.27",
3
+ "version": "3.8.29",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -4533,8 +4533,8 @@ export async function recurringFlagAlert( req, res ) {
4533
4533
  } );
4534
4534
  }
4535
4535
  const g = groupMap.get( k );
4536
- g.questionCount += 1;
4537
- g.runAICount += ( i.runAICount || 0 );
4536
+ if ( i.sopFired ) g.questionCount += 1;
4537
+ if ( i.runAIFired ) g.runAICount += 1;
4538
4538
  if ( parseSubmissionDate( i.lastSubmissionDate ) > parseSubmissionDate( g.lastSubmissionDate ) ) {
4539
4539
  g.lastSubmissionDate = i.lastSubmissionDate;
4540
4540
  g.lastSubmittedBy = i.lastSubmittedBy;
@@ -4573,6 +4573,7 @@ export async function recurringFlagAlert( req, res ) {
4573
4573
  isMultiStore,
4574
4574
  isMultiChecklist,
4575
4575
  isMultiStoreSingleChecklist,
4576
+ isUserCoverage: isAllUser,
4576
4577
  showTable: isMultiStore || isMultiChecklist,
4577
4578
  hasAttachment,
4578
4579
  domain: flagDomain,
@@ -4699,7 +4700,7 @@ function computeWow( current, previous ) {
4699
4700
 
4700
4701
  async function aggregateWeeklyFlagsByStore( weekStart, weekEnd ) {
4701
4702
  const rows = await processedchecklist.aggregate( [
4702
- { $match: { date_string: { $gte: weekStart, $lte: weekEnd }, isdeleted: { $ne: true } } },
4703
+ { $match: { date_string: { $gte: weekStart, $lte: weekEnd }, checkListType: 'custom' } },
4703
4704
  { $group: {
4704
4705
  _id: { client_id: '$client_id', store_id: '$store_id' },
4705
4706
  storeName: { $last: '$storeName' },
@@ -4982,7 +4983,7 @@ export async function weeklyWrapAlert( req, res ) {
4982
4983
  // resolveUserAssignedStores — superadmin / tango users see everything, regular admins see only
4983
4984
  // stores they own (assignedStores + clusters they lead + teams they're in/lead).
4984
4985
  const adminUsers = await userService.find(
4985
- { clientId: String( clientId ), email: { $in: [ 'gopisjkg@gmail.com', 'sh9628hs@gmail.com' ] }, role: { $in: [ 'admin', 'superadmin' ] } },
4986
+ { clientId: String( clientId ), role: { $in: [ 'admin', 'superadmin' ] } },
4986
4987
  { email: 1, assignedStores: 1, userName: 1, userType: 1, role: 1, clientId: 1 },
4987
4988
  );
4988
4989
  console.log( adminUsers );
@@ -467,7 +467,7 @@ export async function startTask( req, res ) {
467
467
  } );
468
468
  const getUpdatedTask = await processedTask.aggregate( findQuery );
469
469
 
470
-
470
+ let cdnurl = JSON.parse( process.env.CDNURL );
471
471
  if ( !( task.checkListFrom && task.checkListFrom == 'api' ) ) {
472
472
  // const bucket = JSON.parse( process.env.BUCKET );
473
473
  await Promise.all(
@@ -2113,8 +2113,12 @@ async function updateRecurringFlagTracker( processedChecklist, questionAnswers,
2113
2113
  } );
2114
2114
  } );
2115
2115
  if ( ops.length ) {
2116
- let data = await recurringFlagTracker.bulkWrite( ops );
2117
- console.log( data );
2116
+ try {
2117
+ let data = await recurringFlagTracker.bulkWrite( ops, { ordered: false } );
2118
+ console.log( 'recurringFlagTracker bulkWrite result', data );
2119
+ } catch ( bulkErr ) {
2120
+ logger.error( { function: 'updateRecurringFlagTracker.bulkWrite', code: bulkErr?.code, message: bulkErr?.message, writeErrors: bulkErr?.writeErrors } );
2121
+ }
2118
2122
  }
2119
2123
  } catch ( error ) {
2120
2124
  logger.error( { function: 'updateRecurringFlagTracker', error } );
@@ -162,7 +162,7 @@
162
162
  <table class="rfTable">
163
163
  <thead>
164
164
  <tr>
165
- {{#if data.isMultiStore}}<th>{{data.subjectLabel}} Name</th>{{/if}}
165
+ {{#if data.isMultiStore}}{{#unless data.isUserCoverage}}<th>{{data.subjectLabel}} Name</th>{{/unless}}{{/if}}
166
166
  {{#unless data.isMultiStoreSingleChecklist}}<th>Checklist Name</th>{{/unless}}
167
167
  <th>Last Submitted By</th>
168
168
  <th>Last Submission Date</th>
@@ -172,7 +172,7 @@
172
172
  <tbody>
173
173
  {{#each data.rows}}
174
174
  <tr>
175
- {{#if ../data.isMultiStore}}<td>{{this.subjectName}}</td>{{/if}}
175
+ {{#if ../data.isMultiStore}}{{#unless ../data.isUserCoverage}}<td>{{this.subjectName}}</td>{{/unless}}{{/if}}
176
176
  {{#unless ../data.isMultiStoreSingleChecklist}}<td>{{this.checklistName}}</td>{{/unless}}
177
177
  <td>{{this.lastSubmittedBy}}</td>
178
178
  <td>{{this.lastSubmissionDate}}</td>
@@ -136,6 +136,10 @@
136
136
  .headertitle.submittedText {
137
137
  width:116px !important;
138
138
  }
139
+
140
+ .flagged {
141
+ color:red
142
+ }
139
143
  </style>
140
144
  </head>
141
145
 
@@ -224,7 +228,7 @@
224
228
  <div class="px-4 answer">
225
229
  {{#if (includes ../../../data.validateType ../answerType)}}
226
230
  {{#eq sopFlag true }}
227
- <span id="agreed" style="color:red">{{answer}}</span><br>
231
+ <span id="agreed flagged">{{answer}}</span><br>
228
232
  {{/eq}}
229
233
  {{#eq sopFlag false }}
230
234
  <span id="agreed">{{answer}}</span><br>
@@ -255,7 +259,7 @@
255
259
  <a href="{{validationAnswer}}" target="_blank" style="text-decoration: underline;color:#0085D2" id="agreed">{{validationAnswer}}</a><br>
256
260
  {{/eq}}
257
261
  {{#eq validationType 'Descriptive Answer'}}
258
- {{validationAnswer}}
262
+ <span class="{{#if this.sopFlag}}flagged{{/if}}">Validation Answer: {{validationAnswer}}</span>
259
263
  {{/eq}}
260
264
  {{#eq validationType 'Capture Multiple Image with description'}}
261
265
  <div class="Reference"><span>Uploaded Image</span><br>
@@ -215,6 +215,17 @@
215
215
  </div>
216
216
  {{/if}}
217
217
  {{/eq}}
218
+ {{#eq this.validationDisplayType 'text'}}
219
+ {{#if this.validationAnswer}}
220
+ <div class="q-answer-text {{#if this.sopFlag}}flagged{{/if}}">validation Answer: {{this.validationAnswer}}</div>
221
+ {{/if}}
222
+ {{/eq}}
223
+ {{#eq this.validationDisplayType 'video'}}
224
+ {{#if this.validationAnswer}}
225
+ <div class="q-answer-caption">Validation Video</div>
226
+ <a class="q-answer-link" href="{{this.validationAnswer}}" target="_blank">{{this.validationAnswer}}</a>
227
+ {{/if}}
228
+ {{/eq}}
218
229
 
219
230
  <table style="width:100%;margin-top:8px;table-layout:fixed"><tr>
220
231
  <td style="width:50%;vertical-align:top;padding-right:8px">
@@ -233,16 +244,54 @@
233
244
  <div class="q-answer-caption">Reference Image</div>
234
245
  <img src="{{this.referenceImage}}" alt="Reference Image" />
235
246
  </div>
247
+ {{else}}
248
+ {{#eq this.answerType 'image'}}
249
+ {{#if this.answer}}
250
+ <div class="q-answer-media">
251
+ <div class="q-answer-caption">Uploaded Image</div>
252
+ <img src="{{this.answer}}" alt="Uploaded Image" />
253
+ </div>
254
+ {{/if}}
255
+ {{/eq}}
236
256
  {{/if}}
237
257
  {{/if}}
258
+ {{else}}
259
+ {{#eq this.answerType 'image'}}
260
+ {{#if this.answer}}
261
+ <div class="q-answer-media">
262
+ <div class="q-answer-caption">Uploaded Image</div>
263
+ <img src="{{this.answer}}" alt="Uploaded Image" />
264
+ </div>
265
+ {{/if}}
266
+ {{/eq}}
238
267
  {{/neq}}
268
+ {{else}}
269
+ {{#eq this.answerType 'image'}}
270
+ {{#if this.answer}}
271
+ <div class="q-answer-media">
272
+ <div class="q-answer-caption">Uploaded Image</div>
273
+ <img src="{{this.answer}}" alt="Uploaded Image" />
274
+ </div>
275
+ {{/if}}
276
+ {{/eq}}
239
277
  {{/neq}}
240
278
  </td>
241
279
  <td style="width:50%;vertical-align:top;padding-left:8px">
242
280
  {{#eq this.answerType 'image'}}
243
281
  {{#if this.answer}}
244
- <div class="q-answer-caption">Uploaded Image</div>
245
- <img src="{{this.answer}}" alt="Uploaded Image" />
282
+ {{#neq ../answerType 'image/video'}}
283
+ {{#neq ../answerType 'multipleImage'}}
284
+ {{#if this.multiReferenceImage.length}}
285
+ <div class="q-answer-caption">Uploaded Image</div>
286
+ <img src="{{this.answer}}" alt="Uploaded Image" />
287
+ {{else}}
288
+ {{#if this.referenceImage}}
289
+ <div class="q-answer-caption">Uploaded Image</div>
290
+ <img src="{{this.answer}}" alt="Uploaded Image" />
291
+ {{/if}}
292
+ {{/if}}
293
+ {{/neq}}
294
+ {{/neq}}
246
295
  {{/if}}
247
296
  {{/eq}}
248
297
  {{#if this.validation}}
@@ -251,18 +300,7 @@
251
300
  <div class="q-answer-caption">Validation Image</div>
252
301
  <img src="{{this.validationAnswer}}" alt="Validation Image" />
253
302
  {{/if}}
254
- {{/eq}}
255
- {{#eq this.validationDisplayType 'video'}}
256
- {{#if this.validationAnswer}}
257
- <div class="q-answer-caption">Validation Video</div>
258
- <a class="q-answer-link" href="{{this.validationAnswer}}" target="_blank">{{this.validationAnswer}}</a>
259
- {{/if}}
260
- {{/eq}}
261
- {{#eq this.validationDisplayType 'text'}}
262
- {{#if this.validationAnswer}}
263
- <div class="q-answer-text">{{this.validationAnswer}}</div>
264
- {{/if}}
265
- {{/eq}}
303
+ {{/eq}}
266
304
  {{#eq this.validationDisplayType 'multiImage'}}
267
305
  {{#if this.validationImage.length}}
268
306
  <div class="q-answer-caption">Validation Image</div>