fortune-sheet icon indicating copy to clipboard operation
fortune-sheet copied to clipboard

Selection calculation breaks for NaN

Open sanchit3008 opened this issue 1 year ago • 1 comments

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.

sanchit3008 avatar Feb 14 '24 11:02 sanchit3008

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.

sanchit3008 avatar Feb 14 '24 17:02 sanchit3008