tango-app-api-trax 3.6.0-task-1 → 3.6.0-task-2

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-task-1",
3
+ "version": "3.6.0-task-2",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -2024,30 +2024,33 @@ export async function submitTask( req, res ) {
2024
2024
 
2025
2025
  if ( updateResult.modifiedCount > 0 ) {
2026
2026
  if ( submittype === 'submit' ) {
2027
- const query1 = [
2028
- {
2029
- $match: {
2030
- userId: user._id,
2031
- sourceCheckList_id: checklist.sourceCheckList_id,
2032
- checklistStatus: { $in: [ 'open', 'inprogress' ] },
2027
+ const excludedChecklists = [ 'Store Hygiene Check', 'EyeTest QR Verification' ];
2028
+ if ( !excludedChecklists.includes( checklist.checkListName ) ) {
2029
+ const query1 = [
2030
+ {
2031
+ $match: {
2032
+ userId: user._id,
2033
+ sourceCheckList_id: checklist.sourceCheckList_id,
2034
+ checklistStatus: { $in: [ 'open', 'inprogress' ] },
2035
+ },
2033
2036
  },
2034
- },
2035
- {
2036
- $project: {
2037
- _id: 1,
2038
- date_iso: 1,
2039
- date_string: 1,
2037
+ {
2038
+ $project: {
2039
+ _id: 1,
2040
+ date_iso: 1,
2041
+ date_string: 1,
2042
+ },
2040
2043
  },
2041
- },
2042
- ];
2044
+ ];
2043
2045
 
2044
- const processedTasksToDelete = await processedTask.aggregate( query1 );
2046
+ const processedTasksToDelete = await processedTask.aggregate( query1 );
2045
2047
 
2046
- if ( processedTasksToDelete?.length ) {
2047
- const deleteIds = processedTasksToDelete?.filter( ( val ) => val?.date_string !== date )?.map( ( val ) => val?._id );
2048
+ if ( processedTasksToDelete?.length ) {
2049
+ const deleteIds = processedTasksToDelete?.filter( ( val ) => val?.date_string !== date )?.map( ( val ) => val?._id );
2048
2050
 
2049
- if ( deleteIds?.length ) {
2050
- await processedTask.deleteMany( { _id: { $in: deleteIds } } );
2051
+ if ( deleteIds?.length ) {
2052
+ await processedTask.deleteMany( { _id: { $in: deleteIds } } );
2053
+ }
2051
2054
  }
2052
2055
  }
2053
2056
  } else if ( submittype === 'draft' ) {