mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-11-02 13:12:50 +00:00
fix(rank): reject invalid score dimensions before saving results (#488)
This commit is contained in:
1 parent
456f2bfdbf
commit
2e8600d69d
3 files changed
+44
-1
No files matched your search
+3
-1
@@ -234,8 +234,10 @@ def overall_score(scores: dict) -> int:
|
||||
total = 0.0
|
||||
for dim, weight in WEIGHTS.items():
|
||||
value = scores.get(dim)
|
||||
if not isinstance(value, (int, float)):
|
||||
if isinstance(value, bool) or not isinstance(value, (int, float)):
|
||||
raise ValueError(f"missing or non-numeric score '{dim}'")
|
||||
if not 0 <= value <= 100:
|
||||
raise ValueError(f"score '{dim}' must be finite and between 0 and 100")
|
||||
total += float(value) * weight
|
||||
return int(total + 0.5)
|
||||
|
||||
|
||||
Reference in new issue
Block a user