2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

fixing ,, bug in logbook rewriting, and fixing persons order

This commit is contained in:
Philip Sargent 2024-07-30 00:53:24 +03:00
parent 526d0ad904
commit 62320e9f7e
4 changed files with 8 additions and 8 deletions

View File

@ -76,6 +76,8 @@ class LogbookEntry(TroggleModel):
return index return index
def writelogbook(year, filename): def writelogbook(year, filename):
"""Writes all the database logbook entries into a new logbook.html file
"""
current_expedition = Expedition.objects.get(year=year) current_expedition = Expedition.objects.get(year=year)
logbook_entries = LogbookEntry.objects.filter(expedition=current_expedition).order_by( logbook_entries = LogbookEntry.objects.filter(expedition=current_expedition).order_by(
"slug" "slug"
@ -83,10 +85,8 @@ def writelogbook(year, filename):
print(f" - Logbook to be exported has {len(logbook_entries)} entries in it.") print(f" - Logbook to be exported has {len(logbook_entries)} entries in it.")
template = "logbook2005style.html"
try: try:
t = loader.get_template(template) t = loader.get_template("logbook2005style.html")
logbookfile = t.render({"logbook_entries": logbook_entries}) logbookfile = t.render({"logbook_entries": logbook_entries})
except: except:
print(" ! Very Bad Error RENDERING template " + template) print(" ! Very Bad Error RENDERING template " + template)

View File

@ -161,7 +161,7 @@ class PersonExpedition(TroggleModel):
# is_guest = models.BooleanField(default=False) # This is per-Person, not per-PersonExpedition # is_guest = models.BooleanField(default=False) # This is per-Person, not per-PersonExpedition
class Meta: class Meta:
ordering = ("-expedition",) ordering = ("-expedition", "-person")
# order_with_respect_to = 'expedition' # order_with_respect_to = 'expedition'
def __str__(self): def __str__(self):

View File

@ -59,11 +59,11 @@ LOGBOOK_PARSER_SETTINGS = {
LOGBOOKS_DIR = "years" # subfolder of settings.EXPOWEB LOGBOOKS_DIR = "years" # subfolder of settings.EXPOWEB
ENTRIES = { ENTRIES = {
"2024": 41, "2024": 69,
"2023": 112, "2023": 131,
"2022": 94, "2022": 94,
"2019": 55, "2019": 55,
"2018": 95, "2018": 98,
"2017": 74, "2017": 74,
"2016": 87, "2016": 87,
"2015": 80, "2015": 80,

View File

@ -22,7 +22,7 @@ See troggle/code/views/other.py and core.models/logbooks.py writelogbook(year, f
<hr /> <hr />
<div class="tripdate" id="{{logbook_entry.slug}}">{{logbook_entry.date|date:'Y-m-d'}}</div> <div class="tripdate" id="{{logbook_entry.slug}}">{{logbook_entry.date|date:'Y-m-d'}}</div>
<div class="trippeople">{% for personlogentry in logbook_entry.personlogentry_set.all %}{% if personlogentry.is_logbook_entry_author %}<u>{% if personlogentry.nickname_used %}{{personlogentry.nickname_used|safe}}{% else %}{{personlogentry.personexpedition.person|safe}}{% endif %}</u>,{% endif %}{% endfor %}{% for personlogentry in logbook_entry.personlogentry_set.all %}{% if personlogentry.is_logbook_entry_author %}{% else %}{% if personlogentry.nickname_used %}{{personlogentry.nickname_used|safe}}{% else %}{{personlogentry.personexpedition.person|safe}}{% endif %}{% endif %},{% endfor %}{% if logbook_entry.other_people %}, {{logbook_entry.other_people}}{% endif %}</div> <div class="trippeople">{% for personlogentry in logbook_entry.personlogentry_set.all %}{% if personlogentry.is_logbook_entry_author %}<u>{% if personlogentry.nickname_used %}{{personlogentry.nickname_used|safe}}{% else %}{{personlogentry.personexpedition.person|safe}}{% endif %}</u>,{% endif %}{% endfor %}{% for personlogentry in logbook_entry.personlogentry_set.all %}{% if personlogentry.is_logbook_entry_author %}{% else %}{% if personlogentry.nickname_used %}{{personlogentry.nickname_used|safe}}{% else %}{{personlogentry.personexpedition.person|safe}}{% endif %},{% endif %}{% endfor %}{% if logbook_entry.other_people %}, {{logbook_entry.other_people}}{% endif %}</div>
<div class="triptitle">{{logbook_entry.title|safe}}</div> <div class="triptitle">{{logbook_entry.title|safe}}</div>
{{logbook_entry.text|safe}} {{logbook_entry.text|safe}}
<div class="timeug">T/U: {{logbook_entry.time_underground|safe}} hours</div> <div class="timeug">T/U: {{logbook_entry.time_underground|safe}} hours</div>