tango-app-api-infra 3.9.11 → 3.9.13
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
|
@@ -2579,10 +2579,10 @@ export async function ticketList( req, res ) {
|
|
|
2579
2579
|
let sortKey = null;
|
|
2580
2580
|
if ( inputData.sortBy === 'ticketRaised' ) {
|
|
2581
2581
|
sortKey = 'createdAt';
|
|
2582
|
-
requestedSortType =( req.user.userType === 'tango' && inputData.tangoType === 'store' )? '
|
|
2582
|
+
requestedSortType =( req.user.userType === 'tango' && inputData.tangoType === 'store' )? 'tangoreview' : inputData?.permissionType === 'review' ? 'review' : ( ticketsFeature && !ticketsApproveFeature )? 'review':'approve';
|
|
2583
2583
|
} else if ( inputData.sortBy === 'dueDate' ) {
|
|
2584
2584
|
sortKey = 'dueDate';
|
|
2585
|
-
requestedSortType =( req.user.userType === 'tango' && inputData.tangoType === 'store' )? '
|
|
2585
|
+
requestedSortType =( req.user.userType === 'tango' && inputData.tangoType === 'store' )? 'tangoreview' : inputData?.permissionType === 'review' ? 'review' : ( ticketsFeature && !ticketsApproveFeature )? 'review':'approve';
|
|
2586
2586
|
} else if ( inputData.sortBy === 'storeRevisedAccuracy' ) {
|
|
2587
2587
|
sortKey = 'revicedPerc';
|
|
2588
2588
|
requestedSortType = 'tagging';
|
|
@@ -2603,7 +2603,7 @@ export async function ticketList( req, res ) {
|
|
|
2603
2603
|
requestedSortType = 'approve';
|
|
2604
2604
|
} else if ( inputData.sortBy === 'status' ) {
|
|
2605
2605
|
sortKey = 'status';
|
|
2606
|
-
requestedSortType =( req.user.userType === 'tango' && inputData.tangoType === 'store' )? '
|
|
2606
|
+
requestedSortType =( req.user.userType === 'tango' && inputData.tangoType === 'store' )? 'tangoreview' : inputData?.permissionType === 'review' ? 'review' : ( ticketsFeature && !ticketsApproveFeature )? 'review':'approve';
|
|
2607
2607
|
} else if ( inputData.sortBy === 'comments' ) {
|
|
2608
2608
|
sortKey = 'comments';
|
|
2609
2609
|
requestedSortType = 'finalRevision';
|
|
@@ -2615,16 +2615,7 @@ export async function ticketList( req, res ) {
|
|
|
2615
2615
|
{ [sortField]: { order: sortOrder } },
|
|
2616
2616
|
];
|
|
2617
2617
|
}
|
|
2618
|
-
|
|
2619
|
-
// sortKey = 'status';
|
|
2620
|
-
// requestedSortType = inputData?.permissionType === 'review' ? 'review' : 'approve';
|
|
2621
|
-
// } else if ( inputData.sortBy === 'status' ) {
|
|
2622
|
-
// sortKey = 'status';
|
|
2623
|
-
// requestedSortType = inputData?.permissionType === 'review' ? 'review' : 'approve';
|
|
2624
|
-
// } else if ( inputData.sortBy === 'status' ) {
|
|
2625
|
-
// sortKey = 'status';
|
|
2626
|
-
// requestedSortType = inputData?.permissionType === 'review' ? 'review' : 'approve';
|
|
2627
|
-
// }
|
|
2618
|
+
|
|
2628
2619
|
|
|
2629
2620
|
if ( requestedSortType ) {
|
|
2630
2621
|
// const fallbackField = 'createdAt';
|
|
@@ -2727,48 +2718,84 @@ export async function ticketList( req, res ) {
|
|
|
2727
2718
|
},
|
|
2728
2719
|
];
|
|
2729
2720
|
break;
|
|
2721
|
+
// case 'revicedPerc':
|
|
2722
|
+
// searchQuery.sort = [
|
|
2723
|
+
// {
|
|
2724
|
+
// _script: {
|
|
2725
|
+
// type: 'string',
|
|
2726
|
+
// script: {
|
|
2727
|
+
// lang: 'painless',
|
|
2728
|
+
// source: `
|
|
2729
|
+
// try {
|
|
2730
|
+
// if (params._source != null && params._source.mappingInfo != null) {
|
|
2731
|
+
// String found = null;
|
|
2732
|
+
|
|
2733
|
+
// for (def item : params._source.mappingInfo) {
|
|
2734
|
+
// if (item != null && item.type == params.miType && item.revicedPerc != null) {
|
|
2735
|
+
// String value = item.revicedPerc.toString();
|
|
2736
|
+
|
|
2737
|
+
// if (found == null || value.compareTo(found) > 0) {
|
|
2738
|
+
// found = value;
|
|
2739
|
+
// }
|
|
2740
|
+
// }
|
|
2741
|
+
// }
|
|
2742
|
+
|
|
2743
|
+
// if (found != null) {
|
|
2744
|
+
// return found;
|
|
2745
|
+
// }
|
|
2746
|
+
// }
|
|
2747
|
+
// } catch (Exception e) {
|
|
2748
|
+
// // ignore and fallback
|
|
2749
|
+
// }
|
|
2750
|
+
|
|
2751
|
+
// // fallback to root-level revicedPerc
|
|
2752
|
+
// if (params._source != null && params._source.revicedPerc != null) {
|
|
2753
|
+
// return params._source.revicedPerc.toString();
|
|
2754
|
+
// }
|
|
2755
|
+
|
|
2756
|
+
// return "";
|
|
2757
|
+
// `,
|
|
2758
|
+
// params: {
|
|
2759
|
+
// miType: requestedSortType,
|
|
2760
|
+
// },
|
|
2761
|
+
// },
|
|
2762
|
+
// order: sortOrder,
|
|
2763
|
+
// },
|
|
2764
|
+
// },
|
|
2765
|
+
// ];
|
|
2766
|
+
// break;
|
|
2730
2767
|
case 'revicedPerc':
|
|
2731
2768
|
searchQuery.sort = [
|
|
2732
2769
|
{
|
|
2733
2770
|
_script: {
|
|
2734
|
-
type: '
|
|
2771
|
+
type: 'number',
|
|
2772
|
+
order: sortOrder,
|
|
2735
2773
|
script: {
|
|
2736
2774
|
lang: 'painless',
|
|
2737
2775
|
source: `
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
return found;
|
|
2754
|
-
}
|
|
2755
|
-
}
|
|
2756
|
-
} catch (Exception e) {
|
|
2757
|
-
// ignore and fallback
|
|
2758
|
-
}
|
|
2759
|
-
|
|
2760
|
-
// fallback to root-level revicedPerc
|
|
2761
|
-
if (params._source != null && params._source.revicedPerc != null) {
|
|
2762
|
-
return params._source.revicedPerc.toString();
|
|
2763
|
-
}
|
|
2776
|
+
try {
|
|
2777
|
+
if (params._source != null && params._source.mappingInfo != null) {
|
|
2778
|
+
for (def item : params._source.mappingInfo) {
|
|
2779
|
+
if (item != null &&
|
|
2780
|
+
item.type == params.miType &&
|
|
2781
|
+
item.revicedPerc != null) {
|
|
2782
|
+
|
|
2783
|
+
String p = item.revicedPerc.toString().replace('%', '').trim();
|
|
2784
|
+
if (p.length() > 0) {
|
|
2785
|
+
return Double.parseDouble(p);
|
|
2786
|
+
}
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2789
|
+
}
|
|
2790
|
+
} catch (Exception e) {}
|
|
2764
2791
|
|
|
2765
|
-
|
|
2766
|
-
|
|
2792
|
+
// IMPORTANT: return null-equivalent for missing types
|
|
2793
|
+
return -1;
|
|
2794
|
+
`,
|
|
2767
2795
|
params: {
|
|
2768
2796
|
miType: requestedSortType,
|
|
2769
2797
|
},
|
|
2770
2798
|
},
|
|
2771
|
-
order: sortOrder,
|
|
2772
2799
|
},
|
|
2773
2800
|
},
|
|
2774
2801
|
];
|
|
@@ -3867,7 +3894,7 @@ export async function ticketList( req, res ) {
|
|
|
3867
3894
|
'Ticket ID': item?.ticketId,
|
|
3868
3895
|
'Store Name': item?.storeName,
|
|
3869
3896
|
'Store ID': item?.storeId,
|
|
3870
|
-
'Ticket Raised': item?.
|
|
3897
|
+
'Ticket Raised': item?.createdAt ? dayjs( item?.createdAt ).format( 'DD MMM, YYYY' ) : '',
|
|
3871
3898
|
'Issue Date': item?.dateString ? dayjs( item.dateString ).format( 'DD MMM, YYYY' ) : '',
|
|
3872
3899
|
'Ticket Type': item?.type,
|
|
3873
3900
|
'Actual FF': item?.footfallCount,
|
|
@@ -3908,7 +3935,7 @@ export async function ticketList( req, res ) {
|
|
|
3908
3935
|
ticketId: item?.ticketId,
|
|
3909
3936
|
storeId: item?.storeId,
|
|
3910
3937
|
storeName: item?.storeName,
|
|
3911
|
-
ticketRaised: item?.
|
|
3938
|
+
ticketRaised: item?.createdAt,
|
|
3912
3939
|
issueDate: item?.dateString,
|
|
3913
3940
|
footfall: item?.footfallCount,
|
|
3914
3941
|
dueDate: ( () => {
|