tango-app-api-analysis-traffic 3.3.1-alpha.21 → 3.3.1-alpha.22

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.3.1-alpha.21",
3
+ "version": "3.3.1-alpha.22",
4
4
  "description": "Traffic Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -791,27 +791,47 @@ export const performanceMatrixV3 = async ( req, res ) => {
791
791
  if ( resultData ) {
792
792
  if ( resultData.status_code == '200' ) {
793
793
  let data = [];
794
- resultData.performanceData.forEach( ( item, index ) => {
795
- let findprevIndex = data.findLastIndex( ( ele ) => ele.position == item.position );
796
- if ( findprevIndex != -1 ) {
797
- item.top = data[findprevIndex].top + 7;
798
- item.left = data[findprevIndex].left + 5;
794
+ let performanceData = resultData.performanceData.reduce( ( acc, ele ) => {
795
+ if ( !acc[ele.position] ) {
796
+ console.log( ele );
797
+ acc[ele.position] = [ ele ];
799
798
  } else {
800
- if ( item.position == 'High_Low' ) {
801
- item.left = 5;
802
- item.top = 10;
803
- } else if ( item.position == 'High_High' ) {
804
- item.left = 50;
805
- item.top = 10;
806
- } else if ( item.position == 'Low_Low' ) {
807
- item.left = 5;
808
- item.top = 55;
799
+ acc[ele.position].push( ele );
800
+ }
801
+ return acc;
802
+ }, {} );
803
+ Object.keys( performanceData ).forEach( ( key ) => {
804
+ performanceData[key].forEach( ( item, index ) => {
805
+ let findprevIndex = data.findIndex( ( ele ) => ele.position == item.position );
806
+ let findLastIndex = data.findLastIndex( ( ele ) => ele.position == item.position );
807
+ if ( findprevIndex != -1 ) {
808
+ let num = index < 5 ? 0 : index < 10 ? 10 : 20;
809
+ let left = data[findLastIndex].left;
810
+ let leftNum = 8;
811
+ if ( [ 0, 5, 10 ].includes( index ) ) {
812
+ left = data[findprevIndex].left;
813
+ leftNum = 0;
814
+ }
815
+ console.log( leftNum );
816
+ item.top = data[findprevIndex].top + num;
817
+ item.left = left + leftNum;
809
818
  } else {
810
- item.left = 50;
811
- item.top = 55;
819
+ if ( item.position == 'High_Low' ) {
820
+ item.left = 3;
821
+ item.top = 10;
822
+ } else if ( item.position == 'High_High' ) {
823
+ item.left = 55;
824
+ item.top = 10;
825
+ } else if ( item.position == 'Low_Low' ) {
826
+ item.left = 3;
827
+ item.top = 55;
828
+ } else {
829
+ item.left = 55;
830
+ item.top = 55;
831
+ }
812
832
  }
813
- }
814
- data.push( item );
833
+ data.push( item );
834
+ } );
815
835
  } );
816
836
  resultData.performanceData = data;
817
837
  return res.sendSuccess( resultData );
@@ -194,6 +194,7 @@ export const validateperformanceMatrixSchema = joi.object( {
194
194
  ...baseSchema,
195
195
  processtype1: joi.string().required(),
196
196
  processtype2: joi.string().required(),
197
+ topStores: joi.number().optional().allow( '' ),
197
198
  } );
198
199
 
199
200
  export const validateperformanceMatrixParams = {