tango-app-api-audit 3.4.68-beta.20 → 3.4.68-beta.22
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/.eslintrc.cjs
CHANGED
package/package.json
CHANGED
|
@@ -57,6 +57,8 @@ export async function getList( req, res ) {
|
|
|
57
57
|
},
|
|
58
58
|
|
|
59
59
|
} );
|
|
60
|
+
} else {
|
|
61
|
+
return res.sendError( 'No data found', 204 );
|
|
60
62
|
}
|
|
61
63
|
let search ={
|
|
62
64
|
'must': filter,
|
|
@@ -213,7 +215,10 @@ export async function getList( req, res ) {
|
|
|
213
215
|
const minutes1 =minutes> 1? `${minutes} mins` : `${minutes} min`;
|
|
214
216
|
const seconds1 = seconds > 1? `${minutes} secs`: seconds == 1? `${minutes} sec` : '';
|
|
215
217
|
const duration =`${minutes1} ${seconds1}`;
|
|
216
|
-
|
|
218
|
+
let userName = '';
|
|
219
|
+
if ( element?._source?.userId&&element?._source?.userId!='' ) {
|
|
220
|
+
userName = await findOneUser( { _id: element?._source?.userId }, { _id: 0, userName: 1 } );
|
|
221
|
+
}
|
|
217
222
|
if ( element?._source?.type == 'physical' ) {
|
|
218
223
|
exportData.push( {
|
|
219
224
|
'Date': dayjs( element?._source?.date ).format( 'D MMM, YYYY' ),
|
|
@@ -254,7 +259,10 @@ export async function getList( req, res ) {
|
|
|
254
259
|
return;
|
|
255
260
|
} else {
|
|
256
261
|
for ( const [ i, item ] of searchValue.entries() ) {
|
|
257
|
-
|
|
262
|
+
let userName='';
|
|
263
|
+
if ( item?._source?.userId&&item?._source?.userId!='' ) {
|
|
264
|
+
userName = await findOneUser( { _id: item?._source?.userId }, { _id: 0, userName: 1 } );
|
|
265
|
+
}
|
|
258
266
|
const testDuration = searchValue[i]?._source?.testDuration;
|
|
259
267
|
const minutes = Math.floor( testDuration / 60 );
|
|
260
268
|
const seconds = testDuration % 60;
|
|
@@ -348,7 +356,7 @@ export async function viewFile( req, res ) {
|
|
|
348
356
|
const searchData = temp?
|
|
349
357
|
getData['lastAuditedDetails']= {
|
|
350
358
|
'auditedBy': getUserName?.userName || '',
|
|
351
|
-
'completionTime': temp?._source?.
|
|
359
|
+
'completionTime': temp?._source?.endTime? dayjs.utc( temp?._source?.endTime ).tz( 'Asia/Kolkata' ).format( 'HH:mm:ss' ): '',
|
|
352
360
|
'timeZone': temp?.timeZone || '',
|
|
353
361
|
} : null;
|
|
354
362
|
getData['complianceScore'] = getData.complianceScore || getData?.totalSteps>0 ? Math.round( ( getData?.coveredStepsAI/ getData?.totalSteps )*100 ): 0;
|
|
@@ -752,7 +760,9 @@ export async function cancel( req, res ) {
|
|
|
752
760
|
logger.info( { getOutput: getOutput } );
|
|
753
761
|
const output = getOutput?.body?.hits?.hits?.length > 0 ? getOutput?.body?.hits?.hits[0] : null;
|
|
754
762
|
let checkReaudited = getOutput?.body?.hits?.hits?.length > 0 ? getOutputHistory?.body?.hits?.hits.filter( ( data ) => data._source.auditType==='Re-Audit'&&data._source.auditStatus==='Re-Audited' ).length:0;
|
|
763
|
+
let checkReauditedData = getOutput?.body?.hits?.hits?.length > 0 ? getOutputHistory?.body?.hits?.hits.filter( ( data ) => data._source.auditType==='Re-Audit'&&data._source.auditStatus==='Re-Audited' ):[];
|
|
755
764
|
let checkaudited = getOutput?.body?.hits?.hits?.length > 0 ? getOutputHistory?.body?.hits?.hits.filter( ( data ) => data._source.auditType==='Audit'&&data._source.auditStatus==='Audited' ).length:0;
|
|
765
|
+
let checkauditedData = getOutput?.body?.hits?.hits?.length > 0 ? getOutputHistory?.body?.hits?.hits.filter( ( data ) => data._source.auditType==='Audit'&&data._source.auditStatus==='Audited' ):[];
|
|
756
766
|
|
|
757
767
|
if ( !output ) {
|
|
758
768
|
return res.sendError( 'No saved records found', 400 );
|
|
@@ -768,7 +778,7 @@ export async function cancel( req, res ) {
|
|
|
768
778
|
auditStatus: checkReaudited>0?'Re-Audited':checkaudited>0?'Audited':'Yet-to-Audit',
|
|
769
779
|
auditType: checkReaudited>0?'Re-Audit':'Audit',
|
|
770
780
|
endTime: dayjs().tz( 'Asia/Kolkata' ),
|
|
771
|
-
|
|
781
|
+
userId: checkaudited>0?checkauditedData[0]?._source?.userId:checkReaudited>0?checkReauditedData[0]?._source?.userId:'',
|
|
772
782
|
};
|
|
773
783
|
await updateOpenSearchData( openSearch.EyeTestOutput, output?._id, { doc: record1 } );
|
|
774
784
|
await updateOpenSearchData( openSearch.EyeTestInput, inputData.id, { doc: record2 } );
|