From a523030e022aad942777b654aedad933ad568890 Mon Sep 17 00:00:00 2001 From: fheinrich <fheinrich@techfak.uni-bielefeld.de> Date: Wed, 27 Mar 2024 15:51:32 +0100 Subject: [PATCH] Fixed negative time ratio in score calc --- cooperative_cuisine/scores.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cooperative_cuisine/scores.py b/cooperative_cuisine/scores.py index 03c9bfd6..05891b2f 100644 --- a/cooperative_cuisine/scores.py +++ b/cooperative_cuisine/scores.py @@ -120,10 +120,10 @@ def stepped_score( raise ValueError("steps and vals must have the same length") for threshold, ratio in zip(reversed(steps), reversed(score_ratios)): - if time_percentage >= threshold: + if max(time_percentage, 0) >= threshold: return float(np.round(max_score * ratio, decimals=round_decimals)) - assert False, "Should not reach here." + assert False, "This should not happen." class ScoreViaHooks(HookCallbackClass): -- GitLab