From 0f024b27f017bd9ce5cf08de4a0753a75752f993 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Mon, 29 Mar 2021 02:06:19 +0100 Subject: Replace assert() with DataIssue message --- core/models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'core/models.py') diff --git a/core/models.py b/core/models.py index eb8428d..9fa7cec 100644 --- a/core/models.py +++ b/core/models.py @@ -112,8 +112,12 @@ class Expedition(TroggleModel): def get_expedition_day(self, date): expeditiondays = self.expeditionday_set.filter(date=date) if expeditiondays: - assert len(expeditiondays) == 1 - return expeditiondays[0] + if len(expeditiondays) == 1: + return expeditiondays[0] + else: + message ='! - more than one datum in an expeditionday: {}'.format(date) + DataIssue.objects.create(parser='expedition', message=message) + return expeditiondays[0] res = ExpeditionDay(expedition=self, date=date) res.save() return res -- cgit v1.2.3