diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-07-13 22:20:01 +0200 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-07-13 22:20:01 +0200 |
commit | 761a71930b1a6a8ffc329562e46ae0cc8e78645c (patch) | |
tree | 46cd9977f4e1e5f1c098612226fcfcad7f89fd9c /core/models/survex.py | |
parent | 127002d73620cb8c4face31a053deb3887b3e2fa (diff) | |
download | troggle-761a71930b1a6a8ffc329562e46ae0cc8e78645c.tar.gz troggle-761a71930b1a6a8ffc329562e46ae0cc8e78645c.tar.bz2 troggle-761a71930b1a6a8ffc329562e46ae0cc8e78645c.zip |
hack to stop crash
Diffstat (limited to 'core/models/survex.py')
-rw-r--r-- | core/models/survex.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/models/survex.py b/core/models/survex.py index f62d93b..7b69b64 100644 --- a/core/models/survex.py +++ b/core/models/survex.py @@ -229,7 +229,11 @@ class SurvexBlock(models.Model): """This is used to set different colours for the different trips on the calendar view of the expedition""" mx = 10 - index = list(SurvexBlock.objects.filter(date=self.date)).index(self) + try: + index = list(SurvexBlock.objects.filter(date=self.date)).index(self) + except: + print(f"DayIndex: BAD BAD BAD SurvexBlock items on one day '{index}' {self}") + index = 0 if index not in range(0, mx): print(f"DayIndex: More than {mx-1} SurvexBlock items on one day '{index}' {self}") index = 0 |