tango-app-api-task 1.0.0-beta.18 → 1.0.0-beta.19

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-task",
3
- "version": "1.0.0-beta.18",
3
+ "version": "1.0.0-beta.19",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -983,20 +983,23 @@ async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date,
983
983
  await taskProcessedService.deleteMany( assigndeletequery );
984
984
  }
985
985
 
986
- // const persistTaskQuery = {
987
- // date_iso: date,
988
- // client_id: insertdata.client_id,
989
- // checkListId: updatedchecklist._id,
990
- // redoStatus: true,
991
- // checklistStatus: { $nin: [ 'submit' ] },
992
- // };
993
-
994
- // const taskToPersist = await taskProcessedService.find( persistTaskQuery );
986
+ const retainTaskQuery = {
987
+ date_iso: date,
988
+ client_id: insertdata.client_id,
989
+ checkListId: updatedchecklist._id,
990
+ redoStatus: true,
991
+ checklistStatus: { $nin: [ 'submit' ] },
992
+ };
995
993
 
994
+ const taskToRetain = await taskProcessedService.find( retainTaskQuery );
996
995
 
997
- // console.log( taskToPersist );
996
+ const insertList = allQuestion.filter( ( item2 ) =>
997
+ !taskToRetain.some( ( item1 ) =>
998
+ item1.store_id === item2.store_id && item1.userEmail === item2.userEmail,
999
+ ),
1000
+ );
998
1001
 
999
- await taskProcessedService.insertMany( allQuestion );
1002
+ await taskProcessedService.insertMany( insertList );
1000
1003
  logger.info( { function: 'insertPCBulk_v3', query: assigndeletequery } );
1001
1004
  }
1002
1005
  }