2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-17 21:37:20 +00:00

Remove unneeded Class ExpeditionDay

This commit is contained in:
2023-01-30 16:42:56 +00:00
parent ebe86d73d4
commit a12f666e96
6 changed files with 20 additions and 67 deletions

View File

@@ -120,7 +120,6 @@ 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)
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)
@@ -162,7 +161,7 @@ class SurvexPersonRole(models.Model):
personname = models.CharField(max_length=100)
person = models.ForeignKey('Person', blank=True, null=True,on_delete=models.SET_NULL)
personexpedition = models.ForeignKey('PersonExpedition', blank=True, null=True,on_delete=models.SET_NULL)
expeditionday = models.ForeignKey("ExpeditionDay", null=True,on_delete=models.SET_NULL)
# expeditionday = models.ForeignKey("ExpeditionDay", null=True,on_delete=models.SET_NULL)
def __str__(self):
return str(self.personname) + " - " + str(self.survexblock)

View File

@@ -84,14 +84,14 @@ class Expedition(TroggleModel):
return urljoin(settings.URL_ROOT, reverse('expedition', args=[self.year]))
class ExpeditionDay(TroggleModel):
"""Exists only on Expedition now. Removed links from logbookentry, personlogentry, survex stuff etc.
"""
expedition = models.ForeignKey("Expedition",on_delete=models.CASCADE)
date = models.DateField()
# class ExpeditionDay(TroggleModel):
# """Exists only on Expedition now. Removed links from logbookentry, personlogentry, survex stuff etc.
# """
# expedition = models.ForeignKey("Expedition",on_delete=models.CASCADE)
# date = models.DateField()
class Meta:
ordering = ('date',)
# class Meta:
# ordering = ('date',)
class Person(TroggleModel):

View File

@@ -103,7 +103,7 @@ def expedition(request, expeditionname):
allpersonlogentries = PersonLogEntry.objects.filter(personexpedition__expedition=expo)
personexpeditiondays = [ ]
personexpodays = [ ]
for personexpedition in expo.personexpedition_set.all():
expotrips = allpersonlogentries.filter(personexpedition=personexpedition) # lazy
expoblocks = blocks.filter(survexpersonrole__personexpedition=personexpedition)
@@ -119,12 +119,12 @@ def expedition(request, expeditionname):
if issunday := (date.weekday() == 6): # WALRUS
pcell["sunday"] = issunday
prow.append(pcell)
personexpeditiondays.append({"personexpedition":personexpedition, "personrow":prow})
personexpodays.append({"personexpedition":personexpedition, "personrow":prow})
ts[expeditionname] = {'expedition': expo,
'expeditions':expeditions,
'personexpeditiondays':personexpeditiondays, 'settings':settings,
'personexpodays':personexpodays, 'settings':settings,
'dateditems': dateditems, 'dates':dates}
TROG['pagecache']['expedition'][expeditionname] = ts[expeditionname]
@@ -219,15 +219,10 @@ def logbookentry(request, date, slug):
jwallets = allwallets.filter(walletdate=date)
for j in jwallets:
wallets.add(j)
# thisexpo = Expedition.objects.get(year=int(date[0:4]))
# if thisexpo:
# #expeditionday = thisexpo.get_expedition_day(date)
# svxothers = SurvexBlock.objects.filter(date=date)
# else:
# svxothers = None
svxothers = SurvexBlock.objects.filter(date=date)
this_logbookentry=this_logbookentry[0]
# This is the only page that uses personlogentry_next and personlogentry_prev
# This is the only page that uses next_.. and prev_..
# and it is calculated on the fly in the model
return render(request, 'logbookentry.html',
{'logbookentry': this_logbookentry, 'trips': trips, 'svxothers': svxothers, 'wallets': wallets})