summaryrefslogtreecommitdiffstats
path: root/parsers/QMs.py
diff options
context:
space:
mode:
Diffstat (limited to 'parsers/QMs.py')
-rw-r--r--parsers/QMs.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/parsers/QMs.py b/parsers/QMs.py
index 602b7af..9de3b4d 100644
--- a/parsers/QMs.py
+++ b/parsers/QMs.py
@@ -30,7 +30,7 @@ def parseCaveQMs(cave,inputFile):
kh=Cave.objects.get(official_name="Kaninchenhöhle")
except Cave.DoesNotExist:
print("KH is not in the database. Please run parsers.cavetab first.")
- parse_KH_QMs(kh, inputFile=inputFile)
+ parse_KH_QMs(kh, inputFile=inputFile)
return
qmPath = settings.EXPOWEB+inputFile
@@ -46,7 +46,7 @@ def parseCaveQMs(cave,inputFile):
if cave=='stein':
placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=year, title="placeholder for QMs in 204", text="QMs temporarily attached to this should be re-attached to their actual trips", defaults={"date": date(year, 1, 1),"cave":steinBr})
elif cave=='hauch':
- placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=year, title="placeholder for QMs in 234", text="QMs temporarily attached to this should be re-attached to their actual trips", defaults={"date": date(year, 1, 1),"cave":hauchHl})
+ placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=year, title="placeholder for QMs in 234", text="QMs temporarily attached to this should be re-attached to their actual trips", defaults={"date": date(year, 1, 1),"cave":hauchHl})
if hadToCreate:
print(cave + " placeholder logbook entry for " + str(year) + " added to database")
QMnum=re.match(r".*?-\d*?-X?(?P<numb>\d*)",line[0]).group("numb")
@@ -59,7 +59,7 @@ def parseCaveQMs(cave,inputFile):
newQM.grade=line[1]
newQM.area=line[2]
newQM.location_description=line[3]
-
+
newQM.completion_description=line[4]
newQM.nearest_station_description=line[5]
if newQM.completion_description: # Troggle checks if QMs are completed by checking if they have a ticked_off_by trip. In the table, completion is indicated by the presence of a completion discription.
@@ -74,11 +74,11 @@ def parseCaveQMs(cave,inputFile):
print("overwriting " + str(preexistingQM) +"\r")
else: # otherwise, print that it was ignored
print("preserving " + str(preexistingQM) + ", which was edited in admin \r")
-
+
except QM.DoesNotExist: #if there is no pre-existing QM, save the new one
- newQM.save()
+ newQM.save()
print("QM "+str(newQM) + ' added to database\r')
-
+
except KeyError: #check on this one
continue
except IndexError:
@@ -106,9 +106,9 @@ def parse_KH_QMs(kh, inputFile):
'nearest_station_name':res['nearest_station'],
'location_description':res['description']
}
-
+
save_carefully(QM,lookupArgs,nonLookupArgs)
-
+
parseCaveQMs(cave='stein',inputFile=r"1623/204/qm.csv")
parseCaveQMs(cave='hauch',inputFile=r"1623/234/qm.csv")