2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 07:47:13 +00:00

QM reports all working

This commit is contained in:
Philip Sargent
2022-07-06 17:35:08 +03:00
parent 7dc3cc3b91
commit d3572e18c3
5 changed files with 67 additions and 59 deletions

View File

@@ -532,11 +532,7 @@ class LoadingSurvex():
# we would have to create one. But that is not obligatory and no QMs loaded from CSVs have one
# Older troggle/CSV assumes a logbook entry 'found_by' for each QM, with a date.
# We have a date from the survexfile. This is needed for the absolute_url resolution..
# We don't know if the survexfile has an associated logbook entry as there is no direct link
# so we create a dummy one anyway. We should make logbook entry links optional in QMs in future and
# remove this hack.
# We don't need this anymore so we don't need to create a placeholder logbook entry.
qmyear = str(survexblock.date)[:4]
blockname = survexblock.name[:7]
logslug = f'D{int(qmyear)}_{blockname}_{int(qm_no):03d}'
@@ -548,27 +544,27 @@ class LoadingSurvex():
place = "oops"
message = f' ! - logbook dummy "{logslug}" {str(survexblock.date)[:11]} for cave "{caveslug}" created.'
# message = f' ! - logbook dummy "{logslug}" {str(survexblock.date)[:11]} for cave "{caveslug}" created.'
placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=qmyear,
place=place,
title="placeholder for survex QM",
text=message,
entry_type="DUMMY",
expedition_id=1,
defaults={"date": survexblock.date,"cave_slug":caveslug, "slug": logslug})
# placeholder, hadToCreate = LogbookEntry.objects.get_or_create(date__year=qmyear,
# place=place,
# title="placeholder for survex QM",
# text=message,
# entry_type="DUMMY",
# expedition_id=1,
# defaults={"date": survexblock.date,"cave_slug":caveslug, "slug": logslug})
# print(insp+message)
# DataIssue.objects.create(parser='survex', message=message)
try:
qm = QM.objects.create(number=qm_no,
# nearest_station=a_survex_station_object, # can be null
# nearest_station=a_survex_station_object, # can be null
nearest_station_description=qm_resolve_station,
nearest_station_name=qm_nearest,
grade=qm_grade.upper(),
location_description=qm_notes,
blockname = blockname, # only set for survex-imported QMs
found_by = placeholder,
# found_by = placeholder,
expoyear = str(survexblock.date.year),
cave = survexblock.survexfile.cave)
qm.save