tango-app-api-analysis-zone 3.4.0-alpha.1 → 3.4.0-alpha.2

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-zone",
3
- "version": "3.4.0-alpha.1",
3
+ "version": "3.4.0-alpha.2",
4
4
  "description": "zone Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -754,23 +754,30 @@ export const ZonewiseCustomerFunnelExport = async ( req, res ) => {
754
754
  let reqestData = req.body;
755
755
  let LamdaURL = 'https://7q6v4wppeubi5kgdffwm37az2e0bfkak.lambda-url.ap-south-1.on.aws/';
756
756
  let resultData = await LamdaServiceCall( LamdaURL, reqestData );
757
+ console.log( resultData );
757
758
  if ( resultData ) {
758
759
  if ( resultData.status_code == '200' ) {
759
760
  if ( reqestData.export ) {
760
761
  if ( resultData.data.length > 0 ) {
761
762
  const exportdata = [];
762
763
  resultData.data.forEach( ( element ) => {
763
- exportdata.push( {
764
+ const row = {
764
765
  'Date': element.date || '--',
765
- 'Footfall': element.footfall || '--',
766
- 'Greetings Count': element.greeting_count || '--',
767
- 'Greetings Rate': ( ( element.greeting_count / element.footfall ) * 100 ).toFixed( 1 ) + '%' || '--',
768
- 'Customer Interacted': element.customer_attended || '--',
769
- 'Interation Rate ': element.interaction_rate +'%',
770
- 'Avg Time To Interact': element.avg_interaction_time || '--',
771
- 'Billing Conversion': element.footfall_overamin_inzone || '--',
772
- 'Billing Conversion Rate': element.billing_conversion_rate +'%',
773
- } );
766
+ 'Footfall': element.footfall ?? '--',
767
+ 'Greetings Count': element.greeting_count ?? '--',
768
+ 'Greetings Rate': ( element.greeting_count && element.footfall ) ? ( ( element.greeting_count / element.footfall ) * 100 ).toFixed( 1 ) + '%': '--',
769
+ 'Customer Interacted': element.customer_attended ?? '--',
770
+ 'Interation Rate ': element.interaction_rate != null ? element.interaction_rate + '%' : '--',
771
+ 'Avg Time To Interact': element.avg_interaction_time ?? '--',
772
+ };
773
+ if ( element.footfall_overamin_inzone != null ) {
774
+ row['Billing Conversion'] = element.footfall_overamin_inzone;
775
+ }
776
+ if ( element.billing_conversion_rate != null ) {
777
+ row['Billing Conversion Rate'] = element.billing_conversion_rate + '%';
778
+ }
779
+
780
+ exportdata.push( row );
774
781
  } );
775
782
  return await download( exportdata, res );
776
783
  } else {