From 1b0fcc1b4d1ee44040857673c11bcf74003cf155 Mon Sep 17 00:00:00 2001 From: Helen Root Date: Tue, 12 Nov 2024 11:55:44 +0100 Subject: [PATCH] Add return type to highlight three-valued logic --- data/models/diagnostic.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/data/models/diagnostic.py b/data/models/diagnostic.py index ab2bd784c..fff641b8f 100644 --- a/data/models/diagnostic.py +++ b/data/models/diagnostic.py @@ -1654,7 +1654,7 @@ def total_family_autres(self): return self.family_sum("autres") @property - def appro_badge(self): + def appro_badge(self) -> bool | None: total = self.value_total_ht if total: bio_share = (self.value_bio_ht or 0) / total @@ -1689,7 +1689,7 @@ def appro_badge(self): return False @property - def waste_badge(self): + def waste_badge(self) -> bool | None: if self.has_waste_diagnostic and self.waste_actions and len(self.waste_actions) > 0: if self.has_donation_agreement or (self.canteen.daily_meal_count and self.canteen.daily_meal_count < 3000): return True @@ -1697,7 +1697,7 @@ def waste_badge(self): return False @property - def diversification_badge(self): + def diversification_badge(self) -> bool | None: if self.vegetarian_weekly_recurrence == Diagnostic.MenuFrequency.DAILY: return True elif self.vegetarian_weekly_recurrence in [Diagnostic.MenuFrequency.MID, Diagnostic.MenuFrequency.HIGH]: @@ -1708,7 +1708,7 @@ def diversification_badge(self): return False @property - def plastic_badge(self): + def plastic_badge(self) -> bool | None: if ( self.cooking_plastic_substituted and self.serving_plastic_substituted @@ -1720,7 +1720,7 @@ def plastic_badge(self): return False @property - def info_badge(self): + def info_badge(self) -> bool | None: if self.communicates_on_food_quality: return True if self.tunnel_info: