summaryrefslogtreecommitdiffstats
path: root/core/models/survex.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-01-29 20:59:56 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2023-01-29 20:59:56 +0000
commit226cbb6b5cb9d38b2856a3007745c8045ed9efae (patch)
tree17a5c3d522a5598815f570abb4ce19aef1f88f67 /core/models/survex.py
parenta1c34f488daac73ad027f03f74a6c725a5ff53d9 (diff)
downloadtroggle-226cbb6b5cb9d38b2856a3007745c8045ed9efae.tar.gz
troggle-226cbb6b5cb9d38b2856a3007745c8045ed9efae.tar.bz2
troggle-226cbb6b5cb9d38b2856a3007745c8045ed9efae.zip
Fixed coloured T and S on expo calendar
Diffstat (limited to 'core/models/survex.py')
-rw-r--r--core/models/survex.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/core/models/survex.py b/core/models/survex.py
index e8538f1..4e852f5 100644
--- a/core/models/survex.py
+++ b/core/models/survex.py
@@ -73,7 +73,6 @@ class SurvexStationLookUpManager(models.Manager):
class SurvexStation(models.Model):
name = models.CharField(max_length=100)
block = models.ForeignKey('SurvexBlock', null=True,on_delete=models.SET_NULL)
-# equate = models.ForeignKey('SurvexEquate', blank=True, null=True,on_delete=models.SET_NULL)
objects = SurvexStationLookUpManager()
x = models.FloatField(blank=True, null=True)
y = models.FloatField(blank=True, null=True)
@@ -112,7 +111,7 @@ class SurvexBlockLookUpManager(models.Manager):
return block
class SurvexBlock(models.Model):
- """One begin..end block within a survex file. The basic elemt of a survey trip.
+ """One begin..end block within a survex file. The basic element of a survey trip.
"""
objects = SurvexBlockLookUpManager()
name = models.CharField(max_length=100)
@@ -121,7 +120,7 @@ class SurvexBlock(models.Model):
cave = models.ForeignKey('Cave', blank=True, null=True,on_delete=models.SET_NULL)
date = models.DateField(blank=True, null=True)
- expeditionday = models.ForeignKey("ExpeditionDay", null=True,on_delete=models.SET_NULL)
+ #expeditionday = models.ForeignKey("ExpeditionDay", null=True,on_delete=models.SET_NULL)
expedition = models.ForeignKey('Expedition', blank=True, null=True,on_delete=models.SET_NULL)
survexfile = models.ForeignKey("SurvexFile", blank=True, null=True,on_delete=models.SET_NULL)
@@ -147,7 +146,14 @@ class SurvexBlock(models.Model):
return True
def DayIndex(self):
- return list(self.expeditionday.survexblock_set.all()).index(self)
+ """This is used to set different colours for the different trips on
+ the calendar view of the expedition"""
+ 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
+ #return list(self.survexblock_set.all()).index(self)
+ return index
class SurvexPersonRole(models.Model):
survexblock = models.ForeignKey('SurvexBlock',on_delete=models.CASCADE)