diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-01-30 15:28:11 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-01-30 15:28:11 +0000 |
commit | 3742e0f3670bfe19c6bccce81a4ef9bb11953067 (patch) | |
tree | 57549d6dcf7851882a56364502effef75192d33b /core/models/survex.py | |
parent | 7d98980121531c8db21256e85590007f621c331c (diff) | |
download | troggle-3742e0f3670bfe19c6bccce81a4ef9bb11953067.tar.gz troggle-3742e0f3670bfe19c6bccce81a4ef9bb11953067.tar.bz2 troggle-3742e0f3670bfe19c6bccce81a4ef9bb11953067.zip |
fixing Sunday display on calendar
Diffstat (limited to 'core/models/survex.py')
-rw-r--r-- | core/models/survex.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/models/survex.py b/core/models/survex.py index 4e852f5..24b679a 100644 --- a/core/models/survex.py +++ b/core/models/survex.py @@ -148,10 +148,11 @@ class SurvexBlock(models.Model): def DayIndex(self): """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) - if index not in range(0,10): - print(f"Unexpected SurvexBlock DayIndex '{index}' {self}") - index = 10 + if index not in range(0, mx): + print(f"DayIndex: More than {mx-1} SurvexBlock items on one day '{index}' {self}") + index = 0 #return list(self.survexblock_set.all()).index(self) return index |