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 {
25
25
if ( data . length === 1 ) {
26
26
min = data [ 0 ] . UnitPrice * data [ 0 ] . UnitsSold ;
27
27
} 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 ) ) ;
29
30
}
30
31
return min ;
31
32
} ;
@@ -35,7 +36,8 @@ export class IgxTotalSaleAggregate {
35
36
if ( data . length === 1 ) {
36
37
max = data [ 0 ] . UnitPrice * data [ 0 ] . UnitsSold ;
37
38
} 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 ) ) ;
39
41
}
40
42
return max ;
41
43
} ;
You can’t perform that action at this time.
0 commit comments