summaryrefslogtreecommitdiffstats
path: root/parsers/logbooks.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-10-01 12:42:47 +0300
committerPhilip Sargent <philip.sargent@gmail.com>2023-10-01 12:42:47 +0300
commit16d3ee9f92914859edd7b568c9dbd802fd93438e (patch)
tree97c07107398f8da09ce5827b1c486a1d7a62a143 /parsers/logbooks.py
parentfd94909ee7e53a4e1defb8202055ac7c211abb1e (diff)
downloadtroggle-16d3ee9f92914859edd7b568c9dbd802fd93438e.tar.gz
troggle-16d3ee9f92914859edd7b568c9dbd802fd93438e.tar.bz2
troggle-16d3ee9f92914859edd7b568c9dbd802fd93438e.zip
Rename lookupAttribs and nonLookupAttribs + add slug to Person
Diffstat (limited to 'parsers/logbooks.py')
-rw-r--r--parsers/logbooks.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py
index 50324a1..90c13aa 100644
--- a/parsers/logbooks.py
+++ b/parsers/logbooks.py
@@ -262,7 +262,7 @@ def store_entry_into_database(date, place, tripcave, title, text, trippersons, a
# if guests:
# print(f" {date} - {guests}")
- nonLookupAttribs = {
+ otherAttribs = {
"place": place,
"other_people": other_people, # *Ol's Mum, foreigners..
"text": text,
@@ -270,20 +270,20 @@ def store_entry_into_database(date, place, tripcave, title, text, trippersons, a
"time_underground": logtime_underground,
"cave_slug": str(tripcave),
}
- lookupAttribs = {"slug": tid, "date": date, "title": title}
+ coUniqueAttribs = {"slug": tid, "date": date, "title": title}
if LogbookEntry.objects.filter(slug=tid).exists():
# oops. Our code should already have ensured this is unique.
message = " ! - DUPLICATE SLUG for logbook entry " + tripdate + " - " + slug
DataIssue.objects.create(parser="logbooks", message=message)
slug = slug + "_" + unique_slug(text,2)
- lbo = LogbookEntry.objects.create(**nonLookupAttribs, **lookupAttribs)
+ lbo = LogbookEntry.objects.create(**otherAttribs, **coUniqueAttribs)
pt_list = []
for tripperson, nickname_used, time_underground in trippersons:
- lookupAttribs = {"personexpedition": tripperson, "nickname_used": nickname_used, "logbook_entry": lbo} # lbo is primary key
- nonLookupAttribs = {"time_underground": time_underground, "is_logbook_entry_author": (tripperson == author)}
- pt_list.append(PersonLogEntry(**nonLookupAttribs, **lookupAttribs))
+ coUniqueAttribs = {"personexpedition": tripperson, "nickname_used": nickname_used, "logbook_entry": lbo} # lbo is primary key
+ otherAttribs = {"time_underground": time_underground, "is_logbook_entry_author": (tripperson == author)}
+ pt_list.append(PersonLogEntry(**otherAttribs, **coUniqueAttribs))
PersonLogEntry.objects.bulk_create(pt_list)
def parser_date(tripdate, year):