summaryrefslogtreecommitdiffstats
path: root/parsers/survex.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-03-16 21:06:52 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2023-03-16 21:06:52 +0000
commit3011e7b11428558360ba2718b8e3d9947607b992 (patch)
tree27a2180936d7f767cfabdffbf9cdc82ad0100bd2 /parsers/survex.py
parent98066591dacdffb4ff33d30bc1cd341bc6f3f229 (diff)
downloadtroggle-3011e7b11428558360ba2718b8e3d9947607b992.tar.gz
troggle-3011e7b11428558360ba2718b8e3d9947607b992.tar.bz2
troggle-3011e7b11428558360ba2718b8e3d9947607b992.zip
Adding QM JSON export
Diffstat (limited to 'parsers/survex.py')
-rw-r--r--parsers/survex.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/parsers/survex.py b/parsers/survex.py
index 1849fce..d8eda23 100644
--- a/parsers/survex.py
+++ b/parsers/survex.py
@@ -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