From a8d1b701a52d4cab71e59d68d22a027e61430528 Mon Sep 17 00:00:00 2001 From: Mohamed-Hacene <90701924+Mohamed-Hacene@users.noreply.github.com> Date: Fri, 22 Nov 2024 12:22:29 +0100 Subject: [PATCH 1/2] hotfix: get_ranking_score() fallback --- backend/core/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/core/models.py b/backend/core/models.py index abc4048ae..f3c9f2f24 100644 --- a/backend/core/models.py +++ b/backend/core/models.py @@ -1660,7 +1660,7 @@ def get_ranking_score(self): if current >= 0 and residual >= 0: value += (1 + current - residual) * (current + 1) return ( - abs(round(value / self.MAP_EFFORT[self.effort], 4)) if self.effort else None + abs(round(value / self.MAP_EFFORT[self.effort], 4)) if self.effort else 0 ) @property From 7fbc4f7fbe011732a52cabc30d74de1b7a40b974 Mon Sep 17 00:00:00 2001 From: Mohamed-Hacene Date: Fri, 22 Nov 2024 12:24:28 +0100 Subject: [PATCH 2/2] chore: run format --- backend/core/models.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/backend/core/models.py b/backend/core/models.py index f3c9f2f24..2421f0d07 100644 --- a/backend/core/models.py +++ b/backend/core/models.py @@ -1659,9 +1659,7 @@ def get_ranking_score(self): residual = risk_scenario.residual_level if current >= 0 and residual >= 0: value += (1 + current - residual) * (current + 1) - return ( - abs(round(value / self.MAP_EFFORT[self.effort], 4)) if self.effort else 0 - ) + return abs(round(value / self.MAP_EFFORT[self.effort], 4)) if self.effort else 0 @property def get_html_url(self):