From d64948749e2f963f1938016764ce8256efd796dd Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sat, 18 Mar 2023 00:57:40 +0000 Subject: [PATCH] more QMs parsed correctly --- parsers/QMs.py | 31 ++++++++++++++++++++++++------- parsers/survex.py | 11 ++--------- templates/cave_qms.html | 12 ++++++------ templates/qm.html | 7 ++++--- 4 files changed, 36 insertions(+), 25 deletions(-) diff --git a/parsers/QMs.py b/parsers/QMs.py index f3044ff..5a0be79 100644 --- a/parsers/QMs.py +++ b/parsers/QMs.py @@ -141,16 +141,26 @@ def parse_KH_QMs(kh, inputFile, ticked): with open(os.path.join(settings.EXPOWEB, inputFile), "r") as khQMfile: khQMs = khQMfile.readlines() nqms = 0 - for line in khQMs: + line = 0 + fails = 0 + for dataline in khQMs: #
C1997-161-27 A
Sib: pitch at end of Fuzzy Logic [Paradox Rift - continues] [sep.fuzzy.13] + line += 1 res = re.search( - r"name=\"[CB](?P\d*)-(?P\d*)-(?P\d*).* (?P[ABCDX])
(?P.*)\[(?P.*)\]", - line, + r"name=\"[CB](?P\d*)-(?P\d*)-(?P\d*).*\s*(?P[ABCDX?V])
(?P.*)(\[(?P.*)\])?", + dataline, ) if res: res = res.groupdict() year = int(res["year"]) - + + nearest_station_name = "" + resolution_station_name = "" + if res["station_name"]: + if ticked: + resolution_station_name = res["station_name"].replace("Open leads
    {% for QM in cave.get_open_QMs %}
  • {{QM}} - {% if QM.nearest_station_name %}§{{QM.nearest_station_name}}§{% endif %} + {% if QM.nearest_station_name %}§{{QM.nearest_station_name|safe}}§{% endif %} {{QM.location_description}} {{QM.grade}} {% if QM.block %} {{QM.block}}.svx {{QM.block.date}} {% endif %}
  • {% empty %} @@ -36,13 +36,13 @@
§ QM.nearest_station_name
-☆ QM.resolution_station_name
+☆ QM.resolution_station_name - when ticked.

Ticked off

    {% for QM in cave.get_ticked_QMs %}
  • {{QM}} - {% if QM.nearest_station_name %}§{{QM.nearest_station_name}}§{% endif %} - {% if QM.resolution_station_name %}☆{{QM.resolution_station_name}}☆{% endif %} - {{QM.location_description}} {{QM.grade}} + {% if QM.nearest_station_name %}§{{QM.nearest_station_name|safe}}§{% endif %} + {% if QM.resolution_station_name %}{{QM.resolution_station_name|safe}}{% endif %} + {{QM.location_description|safe}} {{QM.grade}} {% if QM.block %} {{QM.block}}.svx {{QM.block.date}} {% endif %} {% if QM.completion_description %} @@ -57,5 +57,5 @@

§ QM.nearest_station_name
-☆ QM.resolution_station_name
+☆ QM.resolution_station_name - when ticked.
{% endblock %} \ No newline at end of file diff --git a/templates/qm.html b/templates/qm.html index 1afaa15..d10e742 100644 --- a/templates/qm.html +++ b/templates/qm.html @@ -31,17 +31,18 @@ Tick off completion description: '{{qm.completion_description}}'
Tick off url: {{qm.get_completion_url}} WRONG
Tick off date: '{{qm.completion_date}}' [For survex file ticks. not implemented yet]
{% endif %} +QM page_ref: '{{qm.page_ref}}'
{% if qm.cave %}

Cave: {{qm.cave|safe }}

-All QMs on this cave {{ qm.cave|safe }}
- Cave description {{ qm.cave|safe }} +{{ qm.cave|safe }}All QMs
+{{ qm.cave|safe }} description
+{{ qm.cave }} survexfiles
{% else %}

This QM is OPEN

Comment: '{{qm.comment}}'
{% endif %} -QM page_ref: '{{qm.page_ref}}'

QM Number: {{qm.number}} Grade: {{qm.grade}}