forked from expo/troggle
Adding QM JSON export
This commit is contained in:
@@ -1311,7 +1311,8 @@ class LoadingSurvex:
|
||||
# create a short, hopefully-unique name for this block to be used in the QM id
|
||||
blockname = survexblock.name[:6] + survexblock.name[-1:]
|
||||
# logslug = f'D{int(qmyear)}_{blockname}_{int(qm_no):03d}'
|
||||
|
||||
qm_ticked = False # default
|
||||
|
||||
qm_no = qmline.group(1) # this is NOT unique across multiple survex files
|
||||
qm_grade = qmline.group(2).strip().upper() # TICK or [a-dA-DvVxX?]
|
||||
if qm_grade == "TICK":
|
||||
@@ -1330,13 +1331,20 @@ class LoadingSurvex:
|
||||
# if qmline.group(4):
|
||||
# qm_nearest = qm_nearest + "." + qmline.group(4)
|
||||
|
||||
qm_resolve_station = qmline.group(4)
|
||||
resolution_station_name = qmline.group(4)
|
||||
if (resolution_station_name=="-"):
|
||||
pass
|
||||
else:
|
||||
qm_ticked = True
|
||||
print(f"{survexblock.survexfile.cave} {survexblock}:{qm_no}{qm_grade} {qmline.group(4)}", file=sys.stderr)
|
||||
if resolution_station_name:
|
||||
qm_ticked = True
|
||||
# if qmline.group(6) and qmline.group(6) != "-":
|
||||
# qm_resolve_station = qmline.group(6)
|
||||
# resolution_station_name = qmline.group(6)
|
||||
# if qmline.group(7):
|
||||
# qm_resolve_station = qm_resolve_station + "." + qmline.group(7)
|
||||
# resolution_station_name = resolution_station_name + "." + qmline.group(7)
|
||||
# else:
|
||||
# qm_resolve_station = ""
|
||||
# resolution_station_name = ""
|
||||
qm_notes = qmline.group(5)
|
||||
# qm_notes = qmline.group(8)
|
||||
|
||||
@@ -1364,8 +1372,9 @@ class LoadingSurvex:
|
||||
qm = QM.objects.create(
|
||||
number=qm_no,
|
||||
# nearest_station=a_survex_station_object, # can be null
|
||||
nearest_station_description=qm_resolve_station,
|
||||
resolution_station_name=resolution_station_name,
|
||||
nearest_station_name=qm_nearest,
|
||||
ticked=qm_ticked,
|
||||
grade=qm_grade.upper(),
|
||||
location_description=qm_notes,
|
||||
block=survexblock, # only set for survex-imported QMs
|
||||
@@ -1378,8 +1387,9 @@ class LoadingSurvex:
|
||||
qms = QM.objects.filter(
|
||||
number=qm_no,
|
||||
# nearest_station=a_survex_station_object, # can be null
|
||||
nearest_station_description=qm_resolve_station,
|
||||
resolution_station_name=resolution_station_name,
|
||||
nearest_station_name=qm_nearest,
|
||||
ticked=qm_ticked,
|
||||
grade=qm_grade.upper(),
|
||||
location_description=qm_notes,
|
||||
block=survexblock, # only set for survex-imported QMs
|
||||
|
||||
Reference in New Issue
Block a user