Repository navigation
fix(sum): returns 0 when is empty matching - #9984
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9984 +/- ##
==========================================
+ Coverage 96.38% 96.39% +<.01%
==========================================
Files 63 63
Lines 9389 9395 +6
==========================================
+ Hits 9050 9056 +6
Misses 339 339
Continue to review full report at Codecov.
|
|
@sushantdhiman Could you take a look at this fix too? |
|
I changed to return 0. |
|
|
||
| if (dataType instanceof DataTypes.DECIMAL || dataType instanceof DataTypes.FLOAT) { | ||
| result = parseFloat(result); | ||
| if (!_.isNull(result)) { |
There was a problem hiding this comment.
I kept this change to not return NaN
|
Thanks @t-bonatti
Correct behaviour if we want to know if record exists as per our condition, but I can't say other dialect adheres to this. We can simply return numerical values from |
|
Is this already on 4.42.0? |
|
I am just upgrading to Sequelize 5, and this caught me by surprise. It seems very strange that this method now returns 0 if the result is null. This seems to assume that the result of an aggregation is a number. This is not at all the case in general. It can really be any datatype, and by returning 0 as a default, this breaks the expected type. In our case we are using it to find the max of a date field. |

Pull Request check-list
Please make sure to review and check all of these items:
npm run testornpm run test-DIALECTpass with this change (including linting)?Description of change
Fix #6299