File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ export class IgxTotalSaleAggregate {
2424 if ( data . length === 1 ) {
2525 min = data [ 0 ] . UnitPrice * data [ 0 ] . UnitsSold ;
2626 } else if ( data . length > 1 ) {
27- min = data . reduce ( ( a , b ) => Math . min ( a . UnitPrice * a . UnitsSold , b . UnitPrice * b . UnitsSold ) ) ;
27+ const mappedData = data . map ( x => x . UnitPrice * x . UnitsSold ) ;
28+ min = mappedData . reduce ( ( a , b ) => Math . min ( a , b ) ) ;
2829 }
2930 return min ;
3031 } ;
@@ -34,7 +35,8 @@ export class IgxTotalSaleAggregate {
3435 if ( data . length === 1 ) {
3536 max = data [ 0 ] . UnitPrice * data [ 0 ] . UnitsSold ;
3637 } else if ( data . length > 1 ) {
37- max = data . reduce ( ( a , b ) => Math . max ( a . UnitPrice * a . UnitsSold , b . UnitPrice * b . UnitsSold ) ) ;
38+ const mappedData = data . map ( x => x . UnitPrice * x . UnitsSold ) ;
39+ max = mappedData . reduce ( ( a , b ) => Math . max ( a , b ) ) ;
3840 }
3941 return max ;
4042 } ;
You can’t perform that action at this time.
0 commit comments