tango-app-api-trax 3.8.17-nike → 3.8.18-nike

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.17-nike",
3
+ "version": "3.8.18-nike",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -465,11 +465,13 @@ export async function redoChecklist( req, res ) {
465
465
  let eleIndex = question[sectionIndex].questions.findIndex( ( qn ) => qn.qno == parseInt( ele ) );
466
466
  let element = { ...question[sectionIndex].questions[eleIndex], redo: true, redoComment: '', linkquestionenabled: false };
467
467
  question[sectionIndex].questions[eleIndex] = element;
468
- question[sectionIndex].questions[eleIndex].answers.forEach( ( ans ) => {
469
- ans.validationAnswer = '';
470
- delete ans.redoComment;
471
- delete ans.redo;
472
- } );
468
+ if ( Array.isArray( question?.[sectionIndex]?.questions?.[eleIndex]?.answers )?.length ) {
469
+ question[sectionIndex].questions[eleIndex].answers.forEach( ( ans ) => {
470
+ ans.validationAnswer = '';
471
+ delete ans.redoComment;
472
+ delete ans.redo;
473
+ } );
474
+ }
473
475
  question[sectionIndex].questions[eleIndex].userAnswer = [];
474
476
  question[sectionIndex].questions[eleIndex].remarks = '';
475
477
  } );
@@ -803,9 +805,8 @@ export async function getLogs( req, res ) {
803
805
  let initiatedstatus = {
804
806
  actionType: 'initation',
805
807
  userName: data.initiatedBy,
806
- Timestamp: data.initiatedTime,
808
+ Timestamp: dayjs.utc( data.initiatedTime ),
807
809
  description: data.checklistDescription,
808
-
809
810
  };
810
811
  response.push( initiatedstatus );
811
812
  response.push( userAnswer );
@@ -137,7 +137,9 @@ export async function startChecklist( req, res ) {
137
137
  let updateQuery = {};
138
138
  updateQuery._id = new ObjectId( requestData.processedcheckListId );
139
139
  updateQuery.userId = req.user._id;
140
- updateQuery.date_string = requestData.date;
140
+ if ( getBeforeChecklist?.[0]?.date_string == dayjs().format( 'YYYY-MM-DD' ) ) {
141
+ updateQuery.date_string = requestData.date;
142
+ }
141
143
 
142
144
  if ( PCLQusestion && PCLQusestion?.questionAnswers && PCLQusestion?.questionAnswers.length > 0 ) {
143
145
  await PCLQusestion.questionAnswers.forEach( ( section ) => {
@@ -317,7 +319,7 @@ export async function startChecklist( req, res ) {
317
319
  return res.sendError( 'something went wrong please try again', 500 );
318
320
  }
319
321
  } catch ( e ) {
320
- // console.log( 'e =>', e );
322
+ console.log( 'e =>', e );
321
323
  logger.error( { function: 'startChecklist', error: e, body: req.body } );
322
324
  return res.sendError( e, 500 );
323
325
  }