mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-15 01:17:14 +00:00
Rename lookupAttribs and nonLookupAttribs + add slug to Person
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user