tango-app-api-trax 3.6.0-sec-3 → 3.6.0-sec-5

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.6.0-sec-3",
3
+ "version": "3.6.0-sec-5",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -159,7 +159,11 @@ export async function startChecklist( req, res ) {
159
159
  currentDateTime = dayjs();
160
160
  }
161
161
  } else {
162
- currentDateTime = dayjs();
162
+ if ( requestData.currentTime && requestData.currentTime !='' ) {
163
+ currentDateTime = requestData?.currentTime ? dayjs( requestData.currentTime, 'HH:mm:ss' ) : dayjs();
164
+ } else {
165
+ currentDateTime = dayjs();
166
+ }
163
167
  }
164
168
  updateData.checklistStatus = 'inprogress';
165
169
  updateData.startMobileTime = requestData?.currentTime;
@@ -343,13 +347,29 @@ export async function startTask( req, res ) {
343
347
  }
344
348
  }
345
349
 
346
- const storeTimeZone = await storeService.findOne(
347
- { storeName: task.storeName },
348
- { 'storeProfile.timeZone': 1 },
349
- );
350
- const currentDateTime = storeTimeZone?.storeProfile?.timeZone ?
351
- dayjs().tz( storeTimeZone.storeProfile.timeZone ) :
352
- dayjs();
350
+ // const storeTimeZone = await storeService.findOne(
351
+ // { storeName: task.storeName },
352
+ // { 'storeProfile.timeZone': 1 },
353
+ // );
354
+ // const currentDateTime = storeTimeZone?.storeProfile?.timeZone ?
355
+ // dayjs().tz( storeTimeZone.storeProfile.timeZone ) :
356
+ // dayjs();
357
+
358
+ let currentDateTime;
359
+ if ( getBeforeTask[0].storeName && getBeforeTask[0].storeName!='' ) {
360
+ let storeTimeZone = await storeService.findOne( { storeName: { $regex: getBeforeTask[0].storeName, $options: 'i' }, clientId: getBeforeTask[0].client_id }, { 'storeProfile.timeZone': 1 } );
361
+ if ( storeTimeZone?.storeProfile?.timeZone ) {
362
+ currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
363
+ } else {
364
+ currentDateTime = dayjs();
365
+ }
366
+ } else {
367
+ if ( requestData.currentTime && requestData.currentTime !='' ) {
368
+ currentDateTime = requestData?.currentTime ? dayjs( requestData.currentTime, 'HH:mm:ss' ) : dayjs();
369
+ } else {
370
+ currentDateTime = dayjs();
371
+ }
372
+ }
353
373
 
354
374
  const updateData = {
355
375
  checklistStatus: 'inprogress',
@@ -728,6 +728,7 @@ export const userPerformance = async ( req, res ) => {
728
728
  userEmail: 1,
729
729
  userName: 1,
730
730
  questionCount: 1,
731
+ redoStatus: 1,
731
732
  },
732
733
  } );
733
734
 
@@ -745,6 +746,7 @@ export const userPerformance = async ( req, res ) => {
745
746
  submittedChecklistQuestionCount: {
746
747
  $sum: { $cond: [ { $eq: [ '$checklistStatus', 'submit' ] }, '$questionCount', 0 ] },
747
748
  },
749
+ redo: { $sum: { $cond: [ { $eq: [ '$redoStatus', true ] }, 1, 0 ] } },
748
750
  },
749
751
  } );
750
752
 
@@ -816,6 +818,7 @@ export const userPerformance = async ( req, res ) => {
816
818
  'Email': element.userEmail || '--',
817
819
  'Checklist Assigned': element.checkListCount || '--',
818
820
  'Flags': element.flaggedCount || '--',
821
+ 'ReDo': element.redo || '--',
819
822
  'Completion %': element.completion || '--',
820
823
  'Compliance %': element.compliance || '--',
821
824
  'Performance %': element.performance || '--',
@@ -140,6 +140,7 @@ export const mobileChecklistValidation = {
140
140
  export const startSchema = joi.object( {
141
141
  date: joi.string().required(),
142
142
  processedcheckListId: joi.string().required(),
143
+ currentTime: joi.string().optional().allow( '' ),
143
144
  } );
144
145
 
145
146
  export const startValidation = {