From 9533f59c5517b6b1de272fcfda2488b46840889e Mon Sep 17 00:00:00 2001 From: Teymour Aldridge Date: Fri, 29 Nov 2024 22:59:14 +0100 Subject: [PATCH] Allow zero values for integer feedback scales. --- tabbycat/adjfeedback/admin.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tabbycat/adjfeedback/admin.py b/tabbycat/adjfeedback/admin.py index 9d22d15339a..b9a7b901aa8 100644 --- a/tabbycat/adjfeedback/admin.py +++ b/tabbycat/adjfeedback/admin.py @@ -40,8 +40,11 @@ class Meta: def clean(self): integer_scale = AdjudicatorFeedbackQuestion.ANSWER_TYPE_INTEGER_SCALE if self.cleaned_data.get('answer_type') == integer_scale: - if not self.cleaned_data.get('min_value') or not self.cleaned_data.get('max_value'): - raise forms.ValidationError(_("Integer scales must have a minimum and maximum")) + print(str(self.cleaned_data)) + if self.cleaned_data.get('min_value') is None: + raise forms.ValidationError(_("Error: min_value must be specified for an integer scale.")) + if self.cleaned_data.get('max_value') is None: + raise forms.ValidationError(_("Error: max_value must be specified for an integer scale!")) return self.cleaned_data