From 7daef9f253ed9329d5ce3e42e53b8d0dc4288d9b Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Mon, 20 Oct 2025 22:34:28 +0300 Subject: [PATCH] more detail in wild survex report --- core/models/survex.py | 1 + parsers/survex.py | 11 ++++++++--- templates/survexfilewild.html | 18 +++++++++++++----- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/core/models/survex.py b/core/models/survex.py index de7af54..dad8978 100644 --- a/core/models/survex.py +++ b/core/models/survex.py @@ -222,6 +222,7 @@ class SurvexBlock(models.Model): name = models.CharField(max_length=100) title = models.CharField(max_length=200) parent = models.ForeignKey("SurvexBlock", blank=True, null=True, on_delete=models.SET_NULL, db_index=True) + ref_text = models.CharField(max_length=200, blank=True, null=True) date = models.DateField(blank=True, null=True) expedition = models.ForeignKey("Expedition", blank=True, null=True, on_delete=models.SET_NULL, db_index=True) diff --git a/parsers/survex.py b/parsers/survex.py index 7e88afa..e9c3f60 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -294,7 +294,7 @@ class LoadingSurvex: rx_include = re.compile(r"(?i)^\s*(\*include[\s].*)$") rx_include2 = re.compile("(?i)include$") rx_commref = re.compile(r"(?i)^\s*ref(?:erence)?[\s.:]*(\d+)\s*#\s*(X)?\s*(\d+)") - rx_ref_text = re.compile(r'(?i)^\s*\"[^"]*\"\s*$') + rx_ref_text = re.compile(r'(?i)^\s*\"([^"]*)\"\s*$') rx_star = re.compile(r"(?i)\s*\*[\s,]*(\w+)\s*(.*?)\s*(?:;.*)?$") rx_starref = re.compile(r"(?i)^\s*\*ref[\s.:]*((?:19[6789]\d)|(?:20[0123]\d))\s*#?\s*(X)?\s*(.*?\d+.*?)$") rx_argsref = re.compile(r"(?i)^[\s.:]*((?:19[6789]\d)|(?:20[012345]\d))\s*#?\s*(X)?\s*(.*?\d+.*?)$") @@ -1171,8 +1171,13 @@ class LoadingSurvex: refline = self.rx_ref_text.match(args) if refline: # a textual reference such as "1996-1999 Not-KH survey book pp 92-95" - # this produces a lot of printout, so don't print it - # print(f"{self.insp} *REF quoted text so ignored:{args} in {survexblock.survexfile.path}") + # this produces a lot of printout, so don't print it + reftxt = refline.groups()[0] # only one item in this tuple + if reftxt: + print(f"{self.insp} *REF quoted text: '{reftxt}' in {survexblock.survexfile.path}") + # only store it if not an empty string + survexblock.ref_text = reftxt + survexblock.save() return if len(args) < 4: diff --git a/templates/survexfilewild.html b/templates/survexfilewild.html index 35a1f92..9c4dabe 100644 --- a/templates/survexfilewild.html +++ b/templates/survexfilewild.html @@ -16,7 +16,9 @@ i.e. they have a survex block (begin..end) with no *REF line which refers to the wallet holding the raw data for that block of data.

These have "; Messteam", "; Zeichner" or "; "LUSS Dead Mountains" in the survex block, so are non expo surveys. - + + + {% for sb in svxforeign %} @@ -24,13 +26,16 @@ i.e. they have a survex block (begin..end) with no *REF line which refers to the - + + {% endfor %}
survex block with no *refdateparent blockwithin survex filesurveyed length
survex block with no *refdateparent blockwithin survex filesurveyed lengthForeign?*ref text
{{ sb }} {{sb.parent }} {{sb.survexfile.path}} {{sb.legslength|floatformat:"1g" }}m {% if sb.foreigners %} ✔ {% endif %} {% if sb.ref_text %}{{sb.ref_text|truncatechars:50 }}{% endif %}
-

These do not have "; Messteam", "; Zeichner" or "; "LUSS Dead Mountains" in the survex block, so are probably expo surveys; definitely if they have identified team members (or have zero length). +

These do not have "; Messteam", "; Zeichner" or "; "LUSS Dead Mountains" in the survex block, so are probably expo surveys; definitely if they have identified expo team members (or have zero length). +

If there is a tick on the "Foreign?" field it means that one of the team members has been recognised as a known "foreigner", +probably from a "; Messteam:" line. - + {% for sb in svxwild %} @@ -38,7 +43,10 @@ i.e. they have a survex block (begin..end) with no *REF line which refers to the - + + + + {% endfor %}
survex block with no *refdateparent blockwithin survex filesurveyed lengthteam
survex block with no *refdateparent blockwithin survex filesurveyed lengthteamForeign?*ref text
{{ sb }} {{sb.parent }} {{sb.survexfile.path}} {{sb.legslength|floatformat:"1g" }}m {{sb.team|truncatechars:50 }}
{{sb.team|truncatechars:50 }} {% if sb.foreigners %} ✔ {% endif %} {% if sb.ref_text %}{{sb.ref_text|truncatechars:50 }}{% endif %}