From fb3356810d27fa64334acab161eae381540c112c Mon Sep 17 00:00:00 2001 From: Saurabh Kumar <theskumar@users.noreply.github.com> Date: Wed, 1 May 2024 11:43:33 +0530 Subject: [PATCH] Fix results page when all submissions lack "Requested amount" field (#3904) Fixes https://github.com/HyphaApp/hypha/issues/3902 --- hypha/apply/funds/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hypha/apply/funds/views.py b/hypha/apply/funds/views.py index 51eff4583..3bb6fa42a 100644 --- a/hypha/apply/funds/views.py +++ b/hypha/apply/funds/views.py @@ -1795,7 +1795,10 @@ class SubmissionResultView(SubmissionStatsMixin, FilterView): submission_values = self.object_list.value() count_values = submission_values.get("value__count") total_value = intcomma(submission_values.get("value__sum")) - average_value = intcomma(round(submission_values.get("value__avg"))) + if value := submission_values.get("value__avg"): + average_value = intcomma(round(value)) + else: + average_value = 0 else: count_values = 0 total_value = 0 -- GitLab