x
This commit is contained in:
1 parent
d5ea45a536
commit
afd6904c48
20 files changed
+5435
-51
No files matched your search
@@ -1872,6 +1872,12 @@ export const businessAnalyticsRoute = new Elysia({ prefix: "/business-analytics"
|
||||
.slice(0, 3)
|
||||
.map(([name]) => name);
|
||||
|
||||
let predictedNextOrderDate = "";
|
||||
if (c.lastTimestamp > 0 && c.daysBetweenOrders > 0) {
|
||||
const predictedTs = c.lastTimestamp + c.daysBetweenOrders * 24 * 60 * 60 * 1000;
|
||||
predictedNextOrderDate = new Date(predictedTs).toISOString().slice(0, 10);
|
||||
}
|
||||
|
||||
return {
|
||||
id: c.id,
|
||||
identifier: c.identifier,
|
||||
@@ -1885,6 +1891,7 @@ export const businessAnalyticsRoute = new Elysia({ prefix: "/business-analytics"
|
||||
firstOrderDate: c.firstOrderDate,
|
||||
lastOrderDate: c.lastOrderDate,
|
||||
daysBetweenOrders: c.daysBetweenOrders,
|
||||
predictedNextOrderDate,
|
||||
location: c.location,
|
||||
topProducts: sortedProds,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user