Closed Enderdead closed 1 year ago
Thank you very much @Enderdead for the PR! I think a 0 is an ok solution, though a bit misleading. What about returning a null
?
We can also return a null by replacing this new default value (0) with a python None object (I have already checked this option locally). I am waiting for your feedback to update this PR with a default value of None.
I'd prefer a Python None
object. If you can update this PR for that, that'd be great. Can you also add a brief line to the releasenotes.md
under the backward-compatible changes? I'm going to change the target merge branch for this PR to a staging branch and will update unit test reference results after you make your updates.
Done.
The issue #540 reports an invalid JSON format when a KPI indicator is requested at the beginning of a scenario. This occurs because the kpi_calculator.get_computational_time_ratio function returns an np.nan value when no time ratio is available. Since the Flask JSON encoder cannot convert np.nan to null, this results in an incorrect JSON format.
I propose to return an arbitrary zero value from get_computational_time_ratio if no data is available for computation. This fixes issue #540 with a very minor change.