tango-app-api-analysis-traffic 3.8.7-vms.6 → 3.8.7-vms.8
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 +1 -1
- package/src/controllers/revop.controller.js +125 -69
package/package.json
CHANGED
|
@@ -426,85 +426,141 @@ export async function footFallImages( req, res ) {
|
|
|
426
426
|
switch ( req.user.role ) {
|
|
427
427
|
case 'user':
|
|
428
428
|
const actionTypesUser = [ 'tagging', 'finalreview' ];
|
|
429
|
-
|
|
429
|
+
|
|
430
|
+
temp = [];
|
|
431
|
+
actionTypesUser.forEach( ( type ) => {
|
|
430
432
|
const mapping = getMappingForType( type );
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
433
|
+
if ( type === 'tagging' ) {
|
|
434
|
+
const revisedFootfall = mapping.revicedFootfall ?? 0;
|
|
435
|
+
const revisedPerc =
|
|
436
|
+
footfallValue > 0 ?
|
|
437
|
+
`${Math.round( ( revisedFootfall / footfallValue ) * 100 )}` :
|
|
438
|
+
'0';
|
|
439
|
+
const countObj = mapping.count ? [ ...mapping.count ] : [];
|
|
440
|
+
temp.push( {
|
|
441
|
+
actionType: type,
|
|
442
|
+
footfall: footfallValue,
|
|
443
|
+
revicedFootfall: revisedFootfall,
|
|
444
|
+
revicedPerc: revisedPerc,
|
|
445
|
+
count: countObj,
|
|
446
|
+
createdAt: mapping.createdAt ?? '',
|
|
447
|
+
createdByEmail: mapping.createdByEmail ?? '',
|
|
448
|
+
createdByUserName: mapping.createdByUserName ?? '',
|
|
449
|
+
createdByRole: mapping.createdByRole ?? '',
|
|
450
|
+
isUp: false,
|
|
451
|
+
} );
|
|
452
|
+
} else if ( type !== 'tagging' && mapping.status === 'closed' ) {
|
|
453
|
+
const revisedFootfall = mapping.revicedFootfall ?? 0;
|
|
454
|
+
const revisedPerc =
|
|
455
|
+
footfallValue > 0 ?
|
|
456
|
+
`${Math.round( ( revisedFootfall / footfallValue ) * 100 )}` :
|
|
457
|
+
'0';
|
|
458
|
+
const countObj = mapping.count ? [ ...mapping.count ] : [];
|
|
459
|
+
temp.push( {
|
|
460
|
+
actionType: type,
|
|
461
|
+
footfall: footfallValue,
|
|
462
|
+
revicedFootfall: revisedFootfall,
|
|
463
|
+
revicedPerc: revisedPerc,
|
|
464
|
+
count: countObj,
|
|
465
|
+
createdAt: mapping.createdAt ?? '',
|
|
466
|
+
createdByEmail: mapping.createdByEmail ?? '',
|
|
467
|
+
createdByUserName: mapping.createdByUserName ?? '',
|
|
468
|
+
createdByRole: mapping.createdByRole ?? '',
|
|
469
|
+
} );
|
|
470
|
+
}
|
|
452
471
|
} );
|
|
453
472
|
break;
|
|
454
473
|
case 'admin':
|
|
455
474
|
const actionTypesAdmin = [ 'tagging', 'review', 'finalreview' ];
|
|
456
|
-
temp =
|
|
475
|
+
temp = [];
|
|
476
|
+
actionTypesAdmin.forEach( ( type ) => {
|
|
457
477
|
const mapping = getMappingForType( type );
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
478
|
+
if ( type === 'tagging' ) {
|
|
479
|
+
const revisedFootfall = mapping.revicedFootfall ?? 0;
|
|
480
|
+
const revisedPerc =
|
|
481
|
+
footfallValue > 0 ?
|
|
482
|
+
`${Math.round( ( revisedFootfall / footfallValue ) * 100 )}` :
|
|
483
|
+
'0';
|
|
484
|
+
const countObj = mapping.count ? [ ...mapping.count ] : [];
|
|
485
|
+
temp.push( {
|
|
486
|
+
actionType: type,
|
|
487
|
+
footfall: footfallValue,
|
|
488
|
+
revicedFootfall: revisedFootfall,
|
|
489
|
+
revicedPerc: revisedPerc,
|
|
490
|
+
count: countObj,
|
|
491
|
+
createdAt: mapping.createdAt ?? '',
|
|
492
|
+
createdByEmail: mapping.createdByEmail ?? '',
|
|
493
|
+
createdByUserName: mapping.createdByUserName ?? '',
|
|
494
|
+
createdByRole: mapping.createdByRole ?? '',
|
|
495
|
+
isUp: false,
|
|
496
|
+
} );
|
|
497
|
+
} else if ( type !== 'tagging' && mapping.status === 'closed' ) {
|
|
498
|
+
const revisedFootfall = mapping.revicedFootfall ?? 0;
|
|
499
|
+
const revisedPerc =
|
|
500
|
+
footfallValue > 0 ?
|
|
501
|
+
`${Math.round( ( revisedFootfall / footfallValue ) * 100 )}` :
|
|
502
|
+
'0';
|
|
503
|
+
const countObj = mapping.count ? [ ...mapping.count ] : [];
|
|
504
|
+
temp.push( {
|
|
505
|
+
actionType: type,
|
|
506
|
+
footfall: footfallValue,
|
|
507
|
+
revicedFootfall: revisedFootfall,
|
|
508
|
+
revicedPerc: revisedPerc,
|
|
509
|
+
count: countObj,
|
|
510
|
+
createdAt: mapping.createdAt ?? '',
|
|
511
|
+
createdByEmail: mapping.createdByEmail ?? '',
|
|
512
|
+
createdByUserName: mapping.createdByUserName ?? '',
|
|
513
|
+
createdByRole: mapping.createdByRole ?? '',
|
|
514
|
+
} );
|
|
515
|
+
}
|
|
480
516
|
} );
|
|
481
|
-
break;
|
|
482
517
|
}
|
|
483
518
|
} else {
|
|
484
519
|
const actionTypes = [ 'tagging', 'review', 'approve', 'finalreview' ];
|
|
485
|
-
|
|
520
|
+
|
|
521
|
+
// Dynamically add to temp only if actionType matches and status is 'closed',
|
|
522
|
+
// except for 'tagging' where status must be 'raised'
|
|
523
|
+
temp = [];
|
|
524
|
+
actionTypes.forEach( ( type ) => {
|
|
486
525
|
const mapping = getMappingForType( type );
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
526
|
+
if ( type === 'tagging' ) {
|
|
527
|
+
const revisedFootfall = mapping.revicedFootfall ?? 0;
|
|
528
|
+
const revisedPerc =
|
|
529
|
+
footfallValue > 0 ?
|
|
530
|
+
`${Math.round( ( revisedFootfall / footfallValue ) * 100 )}` :
|
|
531
|
+
'0';
|
|
532
|
+
const countObj = mapping.count ? [ ...mapping.count ] : [];
|
|
533
|
+
temp.push( {
|
|
534
|
+
actionType: type,
|
|
535
|
+
footfall: footfallValue,
|
|
536
|
+
revicedFootfall: revisedFootfall,
|
|
537
|
+
revicedPerc: revisedPerc,
|
|
538
|
+
count: countObj,
|
|
539
|
+
createdAt: mapping.createdAt ?? '',
|
|
540
|
+
createdByEmail: mapping.createdByEmail ?? '',
|
|
541
|
+
createdByUserName: mapping.createdByUserName ?? '',
|
|
542
|
+
createdByRole: mapping.createdByRole ?? '',
|
|
543
|
+
isUp: false,
|
|
544
|
+
} );
|
|
545
|
+
} else if ( type !== 'tagging' && mapping.status === 'closed' ) {
|
|
546
|
+
const revisedFootfall = mapping.revicedFootfall ?? 0;
|
|
547
|
+
const revisedPerc =
|
|
548
|
+
footfallValue > 0 ?
|
|
549
|
+
`${Math.round( ( revisedFootfall / footfallValue ) * 100 )}` :
|
|
550
|
+
'0';
|
|
551
|
+
const countObj = mapping.count ? [ ...mapping.count ] : [];
|
|
552
|
+
temp.push( {
|
|
553
|
+
actionType: type,
|
|
554
|
+
footfall: footfallValue,
|
|
555
|
+
revicedFootfall: revisedFootfall,
|
|
556
|
+
revicedPerc: revisedPerc,
|
|
557
|
+
count: countObj,
|
|
558
|
+
createdAt: mapping.createdAt ?? '',
|
|
559
|
+
createdByEmail: mapping.createdByEmail ?? '',
|
|
560
|
+
createdByUserName: mapping.createdByUserName ?? '',
|
|
561
|
+
createdByRole: mapping.createdByRole ?? '',
|
|
562
|
+
} );
|
|
563
|
+
}
|
|
508
564
|
} );
|
|
509
565
|
}
|
|
510
566
|
|
|
@@ -514,7 +570,7 @@ export async function footFallImages( req, res ) {
|
|
|
514
570
|
if ( resultData ) {
|
|
515
571
|
// temp.length? temp[0].status = 'open': null;
|
|
516
572
|
if ( resultData.status_code == '200' ) {
|
|
517
|
-
return res.sendSuccess( { ...resultData, ticketStatus: temp?.length > 0? temp : null, config: req?.store?.footfallDirectoryConfigs } );
|
|
573
|
+
return res.sendSuccess( { ...resultData, ticketStatus: temp?.length > 0 && ticketDetails? temp : null, config: req?.store?.footfallDirectoryConfigs } );
|
|
518
574
|
} else {
|
|
519
575
|
return res.sendError( 'No Content', 204 );
|
|
520
576
|
}
|