mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-19 01:07:08 +00:00
Renaming class step 2
This commit is contained in:
@@ -34,7 +34,7 @@ Gcave_count = TROG['caves']['gcavecount']
|
||||
Gcavelookup = None
|
||||
Gcave_count = None
|
||||
|
||||
'''The model declarations for Areas, Caves and Entrances. Also LogBookEntry, QM, PersonTrip
|
||||
'''The model declarations for Areas, Caves and Entrances
|
||||
'''
|
||||
|
||||
todo='''
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -162,7 +162,6 @@ 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)
|
||||
# persontrip = models.ForeignKey('PersonTrip', blank=True, null=True,on_delete=models.SET_NULL) # logbook thing not a survex thing
|
||||
expeditionday = models.ForeignKey("ExpeditionDay", null=True,on_delete=models.SET_NULL)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
@@ -93,11 +93,6 @@ class ExpeditionDay(TroggleModel):
|
||||
class Meta:
|
||||
ordering = ('date',)
|
||||
|
||||
# def GetPersonTrip(self, personexpedition):
|
||||
# """returns all logbook trips for this expeditonday
|
||||
# """
|
||||
# personexpeditions = self.persontrip_set.filter(expeditionday=self)
|
||||
# return personexpeditions and personexpeditions[0] or None
|
||||
|
||||
class Person(TroggleModel):
|
||||
"""single Person, can go on many years
|
||||
|
||||
Reference in New Issue
Block a user