From 0a7b3a6cc8065de6b01e18fa1a716c296943c527 Mon Sep 17 00:00:00 2001 From: Victoria Earl Date: Mon, 27 May 2024 11:05:48 -0400 Subject: [PATCH] Fix statistics summary 500 error Someone at MAGStock has no age group label for some reason, causing the summary page to throw a 500 error. This should work around the issue. --- uber/site_sections/statistics.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/uber/site_sections/statistics.py b/uber/site_sections/statistics.py index 0c3e68c9a..c42b82283 100644 --- a/uber/site_sections/statistics.py +++ b/uber/site_sections/statistics.py @@ -197,7 +197,10 @@ def index(self, session): if a.badge_status not in [c.INVALID_GROUP_STATUS, c.INVALID_STATUS, c.IMPORTED_STATUS, c.REFUNDED_STATUS]: counts['paid'][a.paid_label] += 1 - counts['ages'][a.age_group_label] += 1 + if a.age_group_label: + counts['ages'][a.age_group_label] += 1 + else: + counts['ages'][c.AGE_GROUPS[c.AGE_UNKNOWN]] for val in a.ribbon_ints: counts['ribbons'][c.RIBBONS[val]] += 1 counts['badges'][a.badge_type_label] += 1