2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-25 08:41:51 +00:00

hack to stop crash

This commit is contained in:
Philip Sargent 2023-07-13 22:20:01 +02:00
parent 127002d736
commit 761a71930b

View File

@ -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