summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/models/survex.py3
-rw-r--r--core/models/troggle.py16
-rw-r--r--core/views/logbooks.py15
-rw-r--r--parsers/logbooks.py8
-rw-r--r--parsers/survex.py41
-rw-r--r--templates/expedition.html6
6 files changed, 21 insertions, 68 deletions
diff --git a/core/models/survex.py b/core/models/survex.py
index e23cd74..1903755 100644
--- a/core/models/survex.py
+++ b/core/models/survex.py
@@ -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)
diff --git a/core/models/troggle.py b/core/models/troggle.py
index 3be7b5c..c5efa6e 100644
--- a/core/models/troggle.py
+++ b/core/models/troggle.py
@@ -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 Meta:
- ordering = ('date',)
+# 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 Person(TroggleModel):
diff --git a/core/views/logbooks.py b/core/views/logbooks.py
index b7ad2bc..40984bf 100644
--- a/core/views/logbooks.py
+++ b/core/views/logbooks.py
@@ -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})
diff --git a/parsers/logbooks.py b/parsers/logbooks.py
index 8f4acb1..485f993 100644
--- a/parsers/logbooks.py
+++ b/parsers/logbooks.py
@@ -212,15 +212,9 @@ def tidy_tid(tid, title):
return tid
def store_entry_into_database(date, place, tripcave, title, text, trippersons, author, expedition, logtime_underground, tid):
- """saves a single logbook entry and related personlogentrys
- Does NOT save the expeditionday_id - all NULLs. why? Because we are deprecating expeditionday !
+ """saves a single logbook entry and related personlogentry items
"""
- # gets the current ExpeditionDay, and saves it as an object attached to
- # the expedition, but does not attach it to the logbook entry. Why ?
-
- # expedition.get_expedition_day(date)
-
nonLookupAttribs = {
"place": place,
"text": text,
diff --git a/parsers/survex.py b/parsers/survex.py
index f3bbaf1..cf67ed1 100644
--- a/parsers/survex.py
+++ b/parsers/survex.py
@@ -117,7 +117,6 @@ def put_person_on_trip(survexblock, personexpedition, tm):
personrole = SurvexPersonRole.objects.create(
survexblock=survexblock,
person = personexpedition.person,
- # expeditionday = survexblock.expeditionday,
personexpedition=personexpedition,
personname=tm
)
@@ -497,7 +496,6 @@ class LoadingSurvex:
expo = self.get_expo_from_year(year)
survexblock.expedition = expo
- # survexblock.expeditionday = expo.get_expedition_day(survexblock.date)
survexblock.save()
team = get_team_on_trip(survexblock) # should be empty, should only be in 'pending'
@@ -526,44 +524,11 @@ class LoadingSurvex:
message=message,
url=None, sb=(survexblock.survexfile.path),
)
-
-
-
- # All this next section should not happen unless there are >1 *date lines in a block
- # for pr in team: # pr is a PersonRole object
- # if not pr.expeditionday: # *date and *team in 'wrong' order.
-
- # pr.expeditionday = survexblock.expeditionday
- # pr.save()
-
- # if not pr.personexpedition:
- # pe = GetPersonExpeditionNameLookup(expo).get(pr.personname.lower())
- # if pe: # pe is a PersonExpedition
- # # message = "! {} ({}) Fixing undated personexpedition '{}'".format(survexblock.survexfile.path, survexblock, p.personname)
- # # print(self.insp+message)
- # # stash_data_issue(parser='survex', message=message)
- # pr.personexpedition = pe
- # pr.person = pr.personexpedition.person
- # pr.save()
-
- # elif known_foreigner(pr.personname): # note, not using .lower()
- # message = f"- *team {expo.year} '{pr.personname}' known foreigner on *date {survexblock.survexfile.path} ({survexblock}) in '{line}'"
- # print(self.insp + message)
- # # stash_data_issue(parser='survex', message=message, url=None, sb=(survexblock.survexfile.path))
- # else:
- # message = f"! *team {year} '{pr.personname}' FAIL personexpedition lookup on *date {survexblock.survexfile.path} ({survexblock}) '{pr.personname}'"
- # print(self.insp + message)
- # stash_data_issue(
- # parser="survex",
- # message=message,
- # url=None, sb=(survexblock.survexfile.path),
- # )
-
oline = line
if len(line) > 10:
- # message = "! DATE Warning LONG DATE '{}' ({}) {}".format(oline, survexblock, survexblock.survexfile.path)
- # print(self.insp+message)
- # stash_data_issue(parser='survex', message=message, url=None, sb=(survexblock.survexfile.path))
+ message = "! DATE Warning LONG DATE '{}' ({}) {}".format(oline, survexblock, survexblock.survexfile.path)
+ print(self.insp+message)
+ stash_data_issue(parser='survex', message=message, url=None, sb=(survexblock.survexfile.path))
if line[10] == "-": # ie a range, just look at first date
line = line[0:10]
if len(line) == 10:
diff --git a/templates/expedition.html b/templates/expedition.html
index eda8fde..ad6430d 100644
--- a/templates/expedition.html
+++ b/templates/expedition.html
@@ -41,10 +41,10 @@ an "<b>S</b>" for a survey trip. The colours of the "<b>T</b>" and "<b>S</b>" a
</th>
{% endfor %}
</tr>
-{% for personexpeditionday in personexpeditiondays %}
+{% for personexpoday in personexpodays %}
<tr>
- <td><a href="{{ personexpeditionday.personexpedition.get_absolute_url }}">{{personexpeditionday.personexpedition.person|safe}}</a></td>
- {% for activities in personexpeditionday.personrow %}
+ <td><a href="{{ personexpoday.personexpedition.get_absolute_url }}">{{personexpoday.personexpedition.person|safe}}</a></td>
+ {% for activities in personexpoday.personrow %}
{% if activities.personentries or activities.survexblocks %}
<td class="persondayactivity">