fortune-sheet
fortune-sheet copied to clipboard
Selection calculation breaks for NaN
Describe the bug
Due to this commit, cells with ct.t
equal to n
and value equal to NaN
are giving incorrect values for selection count/sum/average.
This is a problem and not backwards compatible with v18 because if you consider the broad use case of filling the cell values in a column dynamically, and one of the cells is has division by 0. The cells are being filled using a loop and have ct.t
as n
. This will make the selection summary not work unless the user specifically checks for NaN and then conditionally sets the ct.t property. The lack of backwards compatibility with this change is an issue.
This can be fixed by adding a NaN check to the if statement referenced in the above mentioned commit.
Expected behavior NaN cells should get ignored instead of being used in the calculation.
This also breaks the selection summary functionality in case ct.t
is not specified explicitly. Why was this change introduced @zyc9012 @GazeWilly ? Pretty sure this needs to be reverted asap to not break a lot of existing functionalities.