summaryrefslogtreecommitdiffstats
path: root/parsers/logbooks.py
diff options
context:
space:
mode:
Diffstat (limited to 'parsers/logbooks.py')
-rw-r--r--parsers/logbooks.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py
index a5f6631..511ed47 100644
--- a/parsers/logbooks.py
+++ b/parsers/logbooks.py
@@ -15,8 +15,7 @@ from parsers.people import GetPersonExpeditionNameLookup, load_people_expos, kno
from troggle.core.models.caves import GetCaveLookup
from troggle.core.models.logbooks import LogbookEntry, PersonLogEntry
from troggle.core.models.troggle import DataIssue, Expedition
-from troggle.core.utils import get_process_memory
-from troggle.core.views.uploads import unique_slug
+from troggle.core.utils import get_process_memory, alphabet_suffix, unique_slug
"""
Parses and imports logbooks in all their wonderful confusion
@@ -109,7 +108,7 @@ ENTRIES = {
logentries = [] # the entire logbook for one year is a single object: a list of entries
noncaveplaces = ["travel", "Journey", "Loser Plateau", "UNKNOWN", "plateau", "base camp", "basecamp", "top camp", "topcamp"]
tripsdate = {}
-alphabet = []
+
def set_trip_seq_id(year, seq):
'''We have not parsed the trip date yet, so this is a sequence numer
@@ -121,15 +120,14 @@ def reset_trip_id(date):
'''Now we have the date, we can set the tripid (the lbe slug) to be in our standard form
of <date><letter>, i.e. '2003-07-30b'
BUT this gets re-set every time the logbook is imported,
- so they are not persistent as we would much prefer.
+ However these are persistent as the entries are ordered on this field.
'''
- global alphabet
already =tripsdate.get(date, 0) # returns zero if none found
- tripsdate[date] = already +1
- if not alphabet:
- alphabet = list(string.ascii_lowercase)
+ n = already + 1
+ tripsdate[date] = n
+ suffix = alphabet_suffix(n)
- tid = f"{date}{alphabet[already]}"
+ tid = f"{date}{suffix}"
# print(tid)
return tid