tango-app-api-infra 3.8.7 → 3.8.9
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
|
@@ -415,9 +415,9 @@ export async function ticketList( req, res ) {
|
|
|
415
415
|
'Duplicates': item?._source?.status === 'closed'? item._source.duplicateACCount : item._source.duplicateCount,
|
|
416
416
|
'Employee/Staff': item?._source?.status === 'closed'? item._source.employeeACCount : item._source.employeeCount,
|
|
417
417
|
'HouseKeeping': item?._source?.status === 'closed'? item._source.houseKeepingACCount : item._source.houseKeepingCount,
|
|
418
|
-
'Junk': item?._source?.status === 'closed'? item._source.junkACCount : item._source.junkCount,
|
|
419
|
-
'Revised Footfall': item?._source?.status === 'closed'? item._source.footfallCount - ( item._source.duplicateACCount + item._source.employeeACCount + item._source.houseKeepingACCount + item._source.junkACCount ) : item._source.footfallCount - ( item._source.duplicateCount + item._source.employeeCount + item._source.houseKeepingCount + item._source.junkCount ),
|
|
420
|
-
'Ticket%': item?._source?.status === 'closed'?`${Math.round( ( ( item._source.duplicateACCount + item._source.employeeACCount + item._source.houseKeepingACCount + item
|
|
418
|
+
'Junk': item?._source?.status === 'closed'? ( item._source.junkACCount || 0 ) : ( item._source.junkCount|| 0 ),
|
|
419
|
+
'Revised Footfall': item?._source?.status === 'closed'? item._source.footfallCount - ( item._source.duplicateACCount + item._source.employeeACCount + item._source.houseKeepingACCount +( item._source.junkACCount || 0 ) ) : item._source.footfallCount - ( item._source.duplicateCount + item._source.employeeCount + item._source.houseKeepingCount + ( item._source.junkCount || 0 ) ),
|
|
420
|
+
'Ticket%': item?._source?.status === 'closed'?`${Math.round( ( ( item._source.duplicateACCount + item._source.employeeACCount + item._source.houseKeepingACCount + ( item?._source?.junkACCount || 0 ) )/ item._source.footfallCount )*100 ).toFixed( 0 )} %` : `${Math.round( ( ( item?._source?.duplicateCount + item?._source?.employeeCount + item?._source?.houseKeepingCount + ( item?._source?.junkCount || 0 ) )/ item?._source?.footfallCount )*100 ).toFixed( 0 )} %`,
|
|
421
421
|
'Status': item._source.status,
|
|
422
422
|
} );
|
|
423
423
|
}
|
|
@@ -1095,10 +1095,10 @@ export async function getTaggedStores( req, res ) {
|
|
|
1095
1095
|
sum: {
|
|
1096
1096
|
script: {
|
|
1097
1097
|
source: `
|
|
1098
|
-
return (doc.containsKey('duplicateCount') ? doc['duplicateCount'].value : 0)
|
|
1099
|
-
+ (doc.containsKey('houseKeepingCount') ? doc['houseKeepingCount'].value : 0)
|
|
1100
|
-
+ (doc.containsKey('employeeCount') ? doc['employeeCount'].value : 0)
|
|
1101
|
-
|
|
1098
|
+
return (doc.containsKey('duplicateCount')&& !doc['duplicateCount'].empty ? doc['duplicateCount'].value : 0)
|
|
1099
|
+
+ (doc.containsKey('houseKeepingCount') && !doc['houseKeepingCount'].empty ? doc['houseKeepingCount'].value : 0)
|
|
1100
|
+
+ (doc.containsKey('employeeCount') && !doc['employeeCount'].empty ? doc['employeeCount'].value : 0)
|
|
1101
|
+
+ (doc.containsKey('junkCount') && !doc['junkCount'].empty ? doc['junkCount'].value : 0);
|
|
1102
1102
|
`,
|
|
1103
1103
|
lang: 'painless',
|
|
1104
1104
|
},
|
|
@@ -1116,10 +1116,10 @@ export async function getTaggedStores( req, res ) {
|
|
|
1116
1116
|
}
|
|
1117
1117
|
|
|
1118
1118
|
const response = geteDataCount?.body?.aggregations?.unique_stores?.buckets;
|
|
1119
|
-
const sorted = sortByTotalCount( response, inputData.sortOrder );
|
|
1120
|
-
sorted?.map( ( item ) => temp.push( { storeId: item.key.storeId, storeName: item.key.storeName, totalCount: item?.totalCount?.value } ) );
|
|
1121
1119
|
|
|
1122
1120
|
if ( response?.length > 0 ) {
|
|
1121
|
+
const sorted = sortByTotalCount( response, inputData.sortOrder );
|
|
1122
|
+
sorted?.map( ( item ) => temp.push( { storeId: item.key.storeId, storeName: item.key.storeName, totalCount: item?.totalCount?.value } ) );
|
|
1123
1123
|
return res.sendSuccess( { result: temp, count: response?.length } );
|
|
1124
1124
|
} else {
|
|
1125
1125
|
return res.sendError( 'NO Data', 204 );
|
|
@@ -1127,7 +1127,7 @@ export async function getTaggedStores( req, res ) {
|
|
|
1127
1127
|
} catch ( error ) {
|
|
1128
1128
|
const err = error.message || 'Internal Server Error';
|
|
1129
1129
|
logger.error( { error: error, messgage: req.query } );
|
|
1130
|
-
return res.
|
|
1130
|
+
return res.sendError( err, 500 );
|
|
1131
1131
|
}
|
|
1132
1132
|
}
|
|
1133
1133
|
|