Skip to content

Commit

Permalink
Fix a crash if WSS/RRF values are NA (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
qubixes authored Mar 12, 2020
1 parent fee9485 commit 388e226
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion asreviewcontrib/statistics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
from asreviewcontrib.statistics.statistics import DataStatistics
from asreviewcontrib.statistics.entrypoint import StatEntryPoint

__version__ = "0.2.0"
__version__ = "0.2.1"
10 changes: 8 additions & 2 deletions asreviewcontrib/statistics/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,16 @@ def __str__(self):
if len(results["wss"]) + len(results["rrf"]) > 0:
stat_str += "----------- WSS/RRF -----------\n"
for wss_at, wss_val in results["wss"].items():
wss_val_str = f"{wss_val:.2f}"
if wss_val is not None:
wss_val_str = f"{wss_val:.2f}"
else:
wss_val_str = "NA"
stat_str += f"WSS@{wss_at: <3}: {wss_val_str: <5} %\n"
for rrf_at, rrf_val in results["rrf"].items():
rrf_val_str = f"{rrf_val:.2f}"
if rrf_val is not None:
rrf_val_str = f"{rrf_val:.2f}"
else:
rrf_val_str = "NA"
stat_str += f"RRF@{rrf_at: <3}: {rrf_val_str: <5} %\n"

return stat_str
Expand Down

0 comments on commit 388e226

Please sign in to comment.