tango-app-api-analysis-traffic 3.8.7-vms.8 → 3.8.7-vms.9
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
|
@@ -221,6 +221,9 @@ export async function storeProcessedData( req, res ) {
|
|
|
221
221
|
dayjs.extend( isSameOrBefore );
|
|
222
222
|
|
|
223
223
|
let start = dayjs( fromDate );
|
|
224
|
+
// get start value from the before day one
|
|
225
|
+
// Move start one day back so we can access "day before" when looping
|
|
226
|
+
start = start.subtract( 1, 'day' );
|
|
224
227
|
let end = dayjs( toDate );
|
|
225
228
|
|
|
226
229
|
if ( !start.isValid() || !end.isValid() ) {
|
|
@@ -267,10 +270,12 @@ export async function storeProcessedData( req, res ) {
|
|
|
267
270
|
|
|
268
271
|
const responseArray = [];
|
|
269
272
|
|
|
270
|
-
for ( let i =
|
|
273
|
+
for ( let i = 1; i < orderedDates.length; i++ ) {
|
|
271
274
|
const currentDate = orderedDates[i];
|
|
272
275
|
const currentId = `${storeId}_${currentDate}`;
|
|
276
|
+
logger.info( { currentId, currentDate } );
|
|
273
277
|
const processedData = hitsMap.get( currentId );
|
|
278
|
+
logger.info( { processedData } );
|
|
274
279
|
if ( !processedData ) {
|
|
275
280
|
responseArray.push( {
|
|
276
281
|
date: currentDate,
|
|
@@ -283,13 +288,17 @@ export async function storeProcessedData( req, res ) {
|
|
|
283
288
|
|
|
284
289
|
const prevDate = dayjs( currentDate ).subtract( 1, 'day' ).format( 'YYYY-MM-DD' );
|
|
285
290
|
const prevId = `${storeId}_${prevDate}`;
|
|
291
|
+
logger.info( { prevId, prevDate } );
|
|
286
292
|
const previousData = hitsMap.get( prevId );
|
|
287
293
|
|
|
288
294
|
let footfallCountTrend = 0;
|
|
295
|
+
logger.info( { previousData, previoucubr1: previousData?.footfall_count } );
|
|
289
296
|
if ( previousData && previousData.footfall_count ) {
|
|
297
|
+
logger.info( { previousData, previoucubr: previousData?.footfall_count } );
|
|
290
298
|
footfallCountTrend = Math.round(
|
|
291
|
-
( ( processedData.footfall_count - previousData
|
|
299
|
+
( ( processedData.footfall_count - previousData?.footfall_count ) / previousData.footfall_count ) * 100,
|
|
292
300
|
);
|
|
301
|
+
logger.info( { footfallCountTrend } );
|
|
293
302
|
}
|
|
294
303
|
// Add ticket status from openSearch.footfallDirectory (_source.status)
|
|
295
304
|
let ticketStatus = null;
|