tango-app-api-trax 3.9.6 → 3.9.8

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.9.6",
3
+ "version": "3.9.8",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -546,7 +546,7 @@ export async function redoChecklist( req, res ) {
546
546
  ...( !checklistConfigDetails?.redoValidity && { reinitiateStatus: true } ),
547
547
  questionAnswers: question,
548
548
  ...( checklistDetails.checklistStatus == 'inprogress' && checklistDetails.redoStatus ) ? { redoEdit: true } : {},
549
- ...( ( checklistDetails.redoEdit === undefined && checklistConfigDetails.redoValidity ) ) ? { scheduleEndTime_iso: dayjs( checklistDetails.scheduleEndTime_iso ).add( checklistConfigDetails.redoValidity, 'day' ).format() } :{},
549
+ ...( !checklistDetails.redoStatus && checklistConfigDetails.redoValidity ) ? { scheduleEndTime_iso: dayjs( checklistDetails.scheduleEndTime_iso ).add( checklistConfigDetails.redoValidity, 'day' ).format() } :{},
550
550
  };
551
551
 
552
552
  let response = await processedChecklist.updateOne( { _id: req.body.payload._id }, updateData );
@@ -660,7 +660,7 @@ export async function sopMobilechecklistQuestionValidatorv1( req, res, next ) {
660
660
  requestSection.forEach( ( item ) => item.section_id = section.section_id );
661
661
  section.questions.forEach( ( question ) => {
662
662
  // question.answers.forEach( ( answer ) => {
663
- let sectionQuestion = requestSection.filter( ( secQuestion ) => secQuestion.qname == question.oldQname || secQuestion.qname == question.qname );
663
+ let sectionQuestion = requestSection.filter( ( secQuestion ) => ( secQuestion.qname == question.oldQname || secQuestion.qname == question.qname ) && ( secQuestion.answerType == question.answerType ) );
664
664
  if ( sectionQuestion.length ) {
665
665
  if ( requestData.submittype == 'submit' ) {
666
666
  if ( ( [ 'multipleImage', 'multiplechoicemultiple', 'image/video' ].includes( question.answerType ) || ( question.answerType =='dropdown' && question.allowMultiple ) ) ) {
@@ -1084,12 +1084,15 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
1084
1084
  try {
1085
1085
  let requestData = req.body;
1086
1086
  requestData.questionAnswers = typeof requestData.questionAnswers == 'string' ? JSON.parse( requestData.questionAnswers ) : requestData.questionAnswers;
1087
- let getChecklistQA = await processedchecklist.findOne( { _id: new ObjectId( requestData.processedcheckListId ) }, { questionAnswers: 1 } );
1087
+ let getChecklistQA = await processedchecklist.findOne( { _id: new ObjectId( requestData.processedcheckListId ) }, { questionAnswers: 1, redoEdit: 1 } );
1088
1088
  let reqAnswers = requestData.questionAnswers;
1089
1089
  logger.error( { functionName: 'updatedPayload', message: reqAnswers } );
1090
1090
  let CLQAnswers = getChecklistQA.questionAnswers;
1091
1091
 
1092
1092
  if ( requestData.submittype == 'submit' ) {
1093
+ if ( getChecklistQA?.redoEdit ) {
1094
+ requestData.submittype = 'draft';
1095
+ }
1093
1096
  reqAnswers.forEach( ( reqA ) => {
1094
1097
  if ( ![ 'multiplechoicemultiple', 'multipleImage', 'image/video' ].includes( reqA?.answerType ) && ( reqA.answerType == 'dropDown' && !reqA.allowMultiple ) ) {
1095
1098
  if ( ( !reqA.linkType && ( reqA.answer == null || reqA.answer == '' ) ) || ( reqA.linkType && reqA.linkquestionenabled && ( reqA.answer == null || reqA.answer == '' ) ) ) {