tango-app-api-analysis-traffic 3.8.7-vms.7 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-analysis-traffic",
3
- "version": "3.8.7-vms.7",
3
+ "version": "3.8.7-vms.9",
4
4
  "description": "Traffic Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -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 = 0; i < orderedDates.length; 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.footfall_count ) / previousData.footfall_count ) * 100,
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;
@@ -447,6 +456,7 @@ export async function footFallImages( req, res ) {
447
456
  createdByEmail: mapping.createdByEmail ?? '',
448
457
  createdByUserName: mapping.createdByUserName ?? '',
449
458
  createdByRole: mapping.createdByRole ?? '',
459
+ isUp: false,
450
460
  } );
451
461
  } else if ( type !== 'tagging' && mapping.status === 'closed' ) {
452
462
  const revisedFootfall = mapping.revicedFootfall ?? 0;
@@ -491,6 +501,7 @@ export async function footFallImages( req, res ) {
491
501
  createdByEmail: mapping.createdByEmail ?? '',
492
502
  createdByUserName: mapping.createdByUserName ?? '',
493
503
  createdByRole: mapping.createdByRole ?? '',
504
+ isUp: false,
494
505
  } );
495
506
  } else if ( type !== 'tagging' && mapping.status === 'closed' ) {
496
507
  const revisedFootfall = mapping.revicedFootfall ?? 0;
@@ -538,6 +549,7 @@ export async function footFallImages( req, res ) {
538
549
  createdByEmail: mapping.createdByEmail ?? '',
539
550
  createdByUserName: mapping.createdByUserName ?? '',
540
551
  createdByRole: mapping.createdByRole ?? '',
552
+ isUp: false,
541
553
  } );
542
554
  } else if ( type !== 'tagging' && mapping.status === 'closed' ) {
543
555
  const revisedFootfall = mapping.revicedFootfall ?? 0;