tango-app-api-audit 3.6.47 → 3.6.48
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
|
@@ -2165,7 +2165,7 @@ export async function summaryList( req, res ) {
|
|
|
2165
2165
|
if ( element?._source?.type == 'physical' ) {
|
|
2166
2166
|
exportData.push( {
|
|
2167
2167
|
'Date': dayjs( element?._source?.date ).format( 'D MMM, YYYY' ),
|
|
2168
|
-
'Audited Date': [ 'Re-Audited', 'Audited' ].includes( element?._source?.auditStatus )?dayjs.utc( element?._source?.updatedAt ).
|
|
2168
|
+
'Audited Date': [ 'Re-Audited', 'Audited' ].includes( element?._source?.auditStatus )? dayjs.utc( element?._source?.updatedAt ).tz( 'Asia/Kolkata' ).format( 'D MMM, YYYY' ): 'NA',
|
|
2169
2169
|
...( req?.user?.role === 'superadmin' && { 'RM Name': RMName } ),
|
|
2170
2170
|
...( req?.user?.role !== 'user' && { 'Cluster Name': clusterName } ),
|
|
2171
2171
|
'Store Name': element?._source?.storeName,
|
|
@@ -2191,7 +2191,7 @@ export async function summaryList( req, res ) {
|
|
|
2191
2191
|
} else {
|
|
2192
2192
|
exportData.push( {
|
|
2193
2193
|
'Date': dayjs( element?._source?.date ).format( 'D MMM, YYYY' ),
|
|
2194
|
-
'Audited Date': [ 'Re-Audited', 'Audited' ].includes( element?._source?.auditStatus )?dayjs.utc( element?._source?.updatedAt ).
|
|
2194
|
+
'Audited Date': [ 'Re-Audited', 'Audited' ].includes( element?._source?.auditStatus )?dayjs.utc( element?._source?.updatedAt ).tz( 'Asia/Kolkata' ).format( 'D MMM, YYYY' ): 'NA',
|
|
2195
2195
|
...( req?.user?.role === 'superadmin' && { 'RM Name': RMName } ),
|
|
2196
2196
|
...( req?.user?.role !== 'user' && { 'Cluster Name': clusterName } ),
|
|
2197
2197
|
'Store Name': element?._source?.storeName,
|
|
@@ -2326,18 +2326,19 @@ export async function summaryList( req, res ) {
|
|
|
2326
2326
|
const minutes = Math.floor( testDuration / 60 );
|
|
2327
2327
|
const seconds = testDuration % 60;
|
|
2328
2328
|
temp[i].complianceScore = `${item?._source?.totalSteps > 0 ? Math.round( ( item?._source?.coveredStepsAI / item?._source?.totalSteps ) * 100 ) : 0} %`;
|
|
2329
|
-
temp[i].humanComplianceScore = [ 'Re-Audited', 'Audited' ].includes( item?._source?.auditStatus ) ?
|
|
2329
|
+
temp[i].humanComplianceScore = [ 'Re-Audited', 'Audited' ].includes( item?._source?.auditStatus ) ?
|
|
2330
|
+
`${item?._source?.totalSteps > 0 ? Math.round( ( item?._source?.auditedSteps / item?._source?.totalSteps ) * 100 ) : 0} %` :
|
|
2331
|
+
'NA';
|
|
2330
2332
|
temp[i].min = minutes;
|
|
2331
2333
|
temp[i].sec = seconds;
|
|
2332
2334
|
temp[i].auditedBy = userName?.userName || '';
|
|
2333
2335
|
temp[i].date = dayjs( item?._source?.date ).format( 'D MMM, YYYY' );
|
|
2334
2336
|
|
|
2335
|
-
// auditedDate
|
|
2337
|
+
// auditedDate: convert from UTC to Asia/Kolkata time zone
|
|
2336
2338
|
if ( [ 'Re-Audited', 'Audited' ].includes( item?._source?.auditStatus ) ) {
|
|
2337
2339
|
const auditedDate = item?._source?.updatedAt;
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
temp[i].auditedDate = auditedDateIST;
|
|
2340
|
+
const auditedDateKolkata = dayjs.utc( auditedDate ).tz( 'Asia/Kolkata' ).format( 'D MMM, YYYY' );
|
|
2341
|
+
temp[i].auditedDate = auditedDateKolkata;
|
|
2341
2342
|
} else {
|
|
2342
2343
|
temp[i].auditedDate = 'NA';
|
|
2343
2344
|
}
|
|
@@ -2627,7 +2628,7 @@ export async function summaryCard( req, res ) {
|
|
|
2627
2628
|
// 5. Past week comparison
|
|
2628
2629
|
'trend': {
|
|
2629
2630
|
date_range: {
|
|
2630
|
-
field: 'date',
|
|
2631
|
+
field: inputData?.dateType === 'auditedDate' ?'updatedAt':'date',
|
|
2631
2632
|
format: 'yyyy-MM-dd',
|
|
2632
2633
|
ranges: [
|
|
2633
2634
|
{ key: 'previous', from: 'now-14d/d', to: 'now-7d/d' },
|