Not quite so broken QMs from survex files

This commit is contained in:
Philip Sargent
2022-07-05 22:40:58 +03:00
parent 2bd617b543
commit 0ea3ed1ef2
6 changed files with 31 additions and 25 deletions

View File

@@ -508,7 +508,8 @@ class LoadingSurvex():
def LoadSurvexQM(self, survexblock, qmline):
insp = self.insp
qm_no = qmline.group(1)
qm_no = qmline.group(1) # this may not be unique across multiple survex files
qm_grade = qmline.group(2)
if qmline.group(3): # usual closest survey station
qm_nearest = qmline.group(3)
@@ -537,7 +538,8 @@ class LoadingSurvex():
# so we create a dummy one anyway. We should make logbook entry links optional in QMs in future and
# remove this hack.
qmyear = str(survexblock.date)[:4]
logslug = f'DUM_{int(qmyear)}_{int(qm_no):03d}'
blockname = survexblock.name
logslug = f'DUM_{int(qmyear)}_{blockname}_{int(qm_no):03d}'
if survexblock.survexfile.cave:
caveslug = survexblock.survexfile.cave.slug()
place = survexblock.survexfile.cave
@@ -565,6 +567,7 @@ class LoadingSurvex():
nearest_station_name=qm_nearest,
grade=qm_grade.upper(),
location_description=qm_notes,
blockname = blockname, # only set for survex-imported QMs
found_by = placeholder,
cave = survexblock.survexfile.cave)
qm.save