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