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 @@ -25,7 +25,8 @@ export class IgxTotalSaleAggregate {
2525 if ( data . length === 1 ) {
2626 min = data [ 0 ] . UnitPrice * data [ 0 ] . UnitsSold ;
2727 } else if ( data . length > 1 ) {
28- min = data . reduce ( ( a , b ) => Math . min ( a . UnitPrice * a . UnitsSold , b . UnitPrice * b . UnitsSold ) ) ;
28+ const mappedData = data . map ( x => x . UnitPrice * x . UnitsSold ) ;
29+ min = mappedData . reduce ( ( a , b ) => Math . min ( a , b ) ) ;
2930 }
3031 return min ;
3132 } ;
@@ -35,7 +36,8 @@ export class IgxTotalSaleAggregate {
3536 if ( data . length === 1 ) {
3637 max = data [ 0 ] . UnitPrice * data [ 0 ] . UnitsSold ;
3738 } else if ( data . length > 1 ) {
38- max = data . reduce ( ( a , b ) => Math . max ( a . UnitPrice * a . UnitsSold , b . UnitPrice * b . UnitsSold ) ) ;
39+ const mappedData = data . map ( x => x . UnitPrice * x . UnitsSold ) ;
40+ max = mappedData . reduce ( ( a , b ) => Math . max ( a , b ) ) ;
3941 }
4042 return max ;
4143 } ;
You can’t perform that action at this time.
0 commit comments