@licklist/design 0.71.11 → 0.71.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/events/event-statistic-modal/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAA;AAKjG,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE;QACT,aAAa,EAAE,MAAM,CAAA;QACrB,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF,CAAA;AAED,eAAO,MAAM,gCAAgC,SACrC,MAAM,kBACI,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/events/event-statistic-modal/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAA;AAKjG,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE;QACT,aAAa,EAAE,MAAM,CAAA;QACrB,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF,CAAA;AAED,eAAO,MAAM,gCAAgC,SACrC,MAAM,kBACI,cAAc,sBAiI/B,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DateTime } from 'luxon';
|
|
2
2
|
import { DATE_FORMAT, DATE_TIME_FULL_FORMAT } from '@licklist/core/dist/Config';
|
|
3
|
-
import {
|
|
3
|
+
import { maxBy } from 'lodash';
|
|
4
4
|
|
|
5
5
|
function _array_like_to_array(arr, len) {
|
|
6
6
|
if (len == null || len > arr.length) len = arr.length;
|
|
@@ -49,7 +49,8 @@ var convertEventStatisticToTableData = function(date, eventStatistic) {
|
|
|
49
49
|
return eventStatistic === null || eventStatistic === void 0 ? void 0 : eventStatistic.productCategorySummary[day];
|
|
50
50
|
}).flat().sort(function(prev, next) {
|
|
51
51
|
return prev.categoryName === next.categoryName ? 0 : prev.categoryName > next.categoryName ? 1 : -1;
|
|
52
|
-
}).forEach(function(param, _,
|
|
52
|
+
}).forEach(function(param, _, // all category at summaryDays
|
|
53
|
+
selfCategory) {
|
|
53
54
|
var totalPerCategory = param.totalPerCategory, _param_productsSummary = param.productsSummary, productsSummary = _param_productsSummary === void 0 ? [] : _param_productsSummary, categoryName = param.categoryName, eventId = param.eventId;
|
|
54
55
|
var quantity = 0;
|
|
55
56
|
totalAmount += totalPerCategory || 0;
|
|
@@ -69,6 +70,7 @@ var convertEventStatisticToTableData = function(date, eventStatistic) {
|
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
productsSummary === null || productsSummary === void 0 ? void 0 : productsSummary.forEach(function(productSummary, productIndex) {
|
|
73
|
+
var _maxBy;
|
|
72
74
|
quantity += productSummary.productsSold;
|
|
73
75
|
var _summaryMap_get;
|
|
74
76
|
var existingProduct = (_summaryMap_get = summaryMap.get("".concat(categoryName, ".").concat(productSummary.name))) !== null && _summaryMap_get !== void 0 ? _summaryMap_get : {
|
|
@@ -80,17 +82,8 @@ var convertEventStatisticToTableData = function(date, eventStatistic) {
|
|
|
80
82
|
var overrides = allProductSummaryAtCategory.filter(function(summary) {
|
|
81
83
|
return summary.originalProductId === productSummary.id;
|
|
82
84
|
});
|
|
83
|
-
var
|
|
84
|
-
|
|
85
|
-
if (override.totalQuantity > (acc || 0)) {
|
|
86
|
-
return override.totalQuantity;
|
|
87
|
-
}
|
|
88
|
-
return acc;
|
|
89
|
-
}, null);
|
|
90
|
-
var totalQuantity = (productSummary.totalQuantity || highestOverrideTotalQuantity) && max([
|
|
91
|
-
productSummary.totalQuantity,
|
|
92
|
-
highestOverrideTotalQuantity
|
|
93
|
-
]);
|
|
85
|
+
var maxTotalQuantity = (_maxBy = maxBy(overrides, 'id')) === null || _maxBy === void 0 ? void 0 : _maxBy.totalQuantity;
|
|
86
|
+
var totalQuantity = maxTotalQuantity || (productSummary === null || productSummary === void 0 ? void 0 : productSummary.totalQuantity);
|
|
94
87
|
summaryMap.set("".concat(categoryName, ".").concat(productSummary.name), {
|
|
95
88
|
name: productSummary.name,
|
|
96
89
|
key: "".concat(eventId, ".").concat(categoryName).concat(productIndex).concat(productSummary.name),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventStatistic } from '@licklist/core/dist/DataMapper/Provider/EventStatisticDataMapper'
|
|
2
2
|
import { DateTime } from 'luxon'
|
|
3
3
|
import { DATE_FORMAT, DATE_TIME_FULL_FORMAT } from '@licklist/core/dist/Config'
|
|
4
|
-
import {
|
|
4
|
+
import { maxBy } from 'lodash'
|
|
5
5
|
|
|
6
6
|
export const TRANSLATION_KEYS = {
|
|
7
7
|
shortQuantity: 'shortQuantity',
|
|
@@ -61,6 +61,7 @@ export const convertEventStatisticToTableData = (
|
|
|
61
61
|
(
|
|
62
62
|
{ totalPerCategory, productsSummary = [], categoryName, eventId },
|
|
63
63
|
_,
|
|
64
|
+
// all category at summaryDays
|
|
64
65
|
selfCategory,
|
|
65
66
|
) => {
|
|
66
67
|
let quantity = 0
|
|
@@ -81,7 +82,6 @@ export const convertEventStatisticToTableData = (
|
|
|
81
82
|
})
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
|
|
85
85
|
productsSummary?.forEach((productSummary, productIndex) => {
|
|
86
86
|
quantity += productSummary.productsSold
|
|
87
87
|
|
|
@@ -98,22 +98,9 @@ export const convertEventStatisticToTableData = (
|
|
|
98
98
|
(summary) => summary.originalProductId === productSummary.id,
|
|
99
99
|
)
|
|
100
100
|
|
|
101
|
-
const
|
|
102
|
-
(acc, override) => {
|
|
103
|
-
if (!override.totalQuantity) return acc
|
|
104
|
-
|
|
105
|
-
if (override.totalQuantity > (acc || 0)) {
|
|
106
|
-
return override.totalQuantity
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return acc
|
|
110
|
-
},
|
|
111
|
-
null,
|
|
112
|
-
)
|
|
101
|
+
const maxTotalQuantity = maxBy(overrides, 'id')?.totalQuantity
|
|
113
102
|
|
|
114
|
-
const totalQuantity =
|
|
115
|
-
(productSummary.totalQuantity || highestOverrideTotalQuantity) &&
|
|
116
|
-
max([productSummary.totalQuantity, highestOverrideTotalQuantity])
|
|
103
|
+
const totalQuantity = maxTotalQuantity || productSummary?.totalQuantity
|
|
117
104
|
|
|
118
105
|
summaryMap.set(`${categoryName}.${productSummary.name}`, {
|
|
119
106
|
name: productSummary.name,
|