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