summaryrefslogtreecommitdiffstats
path: root/core/models.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2021-03-29 02:06:19 +0100
committerPhilip Sargent <philip.sargent@klebos.com>2021-03-29 02:06:19 +0100
commit0f024b27f017bd9ce5cf08de4a0753a75752f993 (patch)
treecddf58d67de25375da9924a13f8ea566e681c4c9 /core/models.py
parentc81f17c24b9683963f37fcee676cd543e5f282b2 (diff)
downloadtroggle-0f024b27f017bd9ce5cf08de4a0753a75752f993.tar.gz
troggle-0f024b27f017bd9ce5cf08de4a0753a75752f993.tar.bz2
troggle-0f024b27f017bd9ce5cf08de4a0753a75752f993.zip
Replace assert() with DataIssue message
Diffstat (limited to 'core/models.py')
-rw-r--r--core/models.py8
1 files changed, 6 insertions, 2 deletions
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