From b5f2d0641d959a8cb5d8898f5ee710de6b3fc277 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Wed, 22 Jun 2022 23:08:32 +0300 Subject: [PATCH] Provide dummy expedition_id to keep MariaDB happy --- parsers/QMs.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/parsers/QMs.py b/parsers/QMs.py index c97fb51..367b4a5 100644 --- a/parsers/QMs.py +++ b/parsers/QMs.py @@ -70,11 +70,11 @@ def parseCaveQMs(cave,inputFile): year=int(line[0][1:5]) logslug = f'PH_{int(year)}_{int(n):02d}' #check if placeholder exists for given year, create it if not - message = " ! - "+ str(year) + " logbook: placeholder entry for '" + cave + "' created. Should be re-attached to the actual trip." + message = " ! - "+ str(year) + " logbook: placeholder entry for '" + cave + "' created. DUMMY EXPEDITION ID. Should be re-attached to the actual trip." if cave=='204-steinBH': - placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=year, place="204", title="placeholder for QMs in 204", text=message, defaults={"date": date(year, 1, 1),"cave_slug":str(steinBr), "slug": logslug}) + placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=year, place="204", title="placeholder for QMs in 204", text=message, entry_type="DUMMY", expedition_id=1, defaults={"date": date(year, 1, 1),"cave_slug":str(steinBr), "slug": logslug}) elif cave=='234-Hauch': - placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=year, place="234", title="placeholder for QMs in 234", text=message, defaults={"date": date(year, 1, 1),"cave_slug":str(hauchHl)}) + placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=year, place="234", title="placeholder for QMs in 234", text=message, entry_type="DUMMY", expedition_id=1, defaults={"date": date(year, 1, 1),"cave_slug":str(hauchHl)}) # if hadToCreate: # print(message) # DataIssue.objects.create(parser='QMs', message=message) @@ -130,8 +130,8 @@ def parse_KH_QMs(kh, inputFile): res=res.groupdict() year=int(res['year']) #check if placeholder exists for given year, create it if not - message = " ! - "+ str(year) + " logbook: placeholder entry for '161 KH' created. Should be re-attached to the actual trip." - placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=year, place="161", title="placeholder for QMs in 161", text=message, defaults={"date": date((year), 1, 1),"cave_slug":str(kh)}) + message = " ! - "+ str(year) + " logbook: placeholder entry for '161 KH' created. DUMMY EXPEDITION ID. Should be re-attached to the actual trip." + placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=year, place="161", title="placeholder for QMs in 161", text=message, entry_type="DUMMY", expedition_id=1, defaults={"date": date((year), 1, 1),"cave_slug":str(kh)}) # if hadToCreate: # print(message) # DataIssue.objects.create(parser='QMs', message=message)