2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 16:57:10 +00:00

Renaming class step 2

This commit is contained in:
2023-01-30 16:18:19 +00:00
parent 58f7cf72d4
commit b29ff61871
12 changed files with 22 additions and 29 deletions

View File

@@ -25,11 +25,10 @@ from troggle.core.models.survex import SurvexStation
from troggle.core.models.troggle import (DataIssue, Expedition, Person,
PersonExpedition, TroggleModel)
'''The model declarations LogBookEntry, PersonTrip, QM
'''The model declarations LogBookEntry, PersonLogEntry, QM
'''
todo='''
- Rename PersonTrip as PersonLogEntry or similar
'''
class CaveSlug(models.Model):
@@ -52,7 +51,7 @@ class LogbookEntry(TroggleModel):
class Meta:
verbose_name_plural = "Logbook Entries"
# several PersonTrips point in to this object
# several PersonLogEntrys point in to this object
ordering = ('-date',)
def cave(self): # Why didn't he just make this a foreign key to Cave ?
@@ -91,7 +90,7 @@ class LogbookEntry(TroggleModel):
return index
class PersonTrip(TroggleModel):
class PersonLogEntry(TroggleModel):
"""Single Person going on a trip, which may or may not be written up.
It could account for different T/U for people in same logbook entry.
"""
@@ -105,14 +104,14 @@ class PersonTrip(TroggleModel):
#order_with_respect_to = 'personexpedition'
def next_personlog(self):
futurePTs = PersonTrip.objects.filter(personexpedition = self.personexpedition, logbook_entry__date__gt = self.logbook_entry.date).order_by('logbook_entry__date').all()
futurePTs = PersonLogEntry.objects.filter(personexpedition = self.personexpedition, logbook_entry__date__gt = self.logbook_entry.date).order_by('logbook_entry__date').all()
if len(futurePTs) > 0:
return futurePTs[0]
else:
return None
def prev_personlog(self):
pastPTs = PersonTrip.objects.filter(personexpedition = self.personexpedition, logbook_entry__date__lt = self.logbook_entry.date).order_by('-logbook_entry__date').all()
pastPTs = PersonLogEntry.objects.filter(personexpedition = self.personexpedition, logbook_entry__date__lt = self.logbook_entry.date).order_by('-logbook_entry__date').all()
if len(pastPTs) > 0:
return pastPTs[0]
else: