From af136d34326530b3a8ca2dd6fcd200f7b3914096 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Mon, 11 Sep 2023 22:42:12 +0300 Subject: fixes --- parsers/caves.py | 12 +++++++----- parsers/survex.py | 3 +-- templates/cave.html | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/parsers/caves.py b/parsers/caves.py index 974f73e..d89aae0 100644 --- a/parsers/caves.py +++ b/parsers/caves.py @@ -111,7 +111,7 @@ def create_new_cave(svxpath, msg=None): # e.g. svxpath = "caves-1623/666/beast" .svx print(f"Create new cave at {svxpath} - {msg}") # - survex_file = svxpath + ".svx" + survex_file = svxpath.replace("caves-","") + ".svx" parts = svxpath.split("/") a = parts[0][-4:] caveid = parts[1] @@ -149,11 +149,13 @@ def create_new_cave(svxpath, msg=None): cave.save() return cave -def do_ARGE_cave(slug, caveid, svxurl, areacode, svxid): +def do_ARGE_cave(slug, caveid, areacode, svxid): """Only called by survex parser, NOT the cave parser. Creates a new Cave object, but with abbreviated data as the survex file (from ARGE) is all we have. We already know the survex file. We already know that the cave doesn't exist... though there are bugs.. + + caveid may be kataster number or it may be e.g. LA34 """ default_note = "This is an ARGE cave where we only have the survex file and no other information" @@ -180,12 +182,12 @@ def do_ARGE_cave(slug, caveid, svxurl, areacode, svxid): line2 = s.readline() line3 = s.readline() else: - print(f"not correct {sv}", file=sys.stderr) + print(f"not correct svxid {svxid} {sv}", file=sys.stderr) cave = Cave( - underground_description="ARGE cave.\n3 lines of the survexfile:\n" + line1 +line2 +line3, + underground_description="ARGE cave.
3 lines of the survexfile:
" + line1 +line2 +line3 +"
", unofficial_number="ARGE", - survex_file= svxurl, + survex_file= f"{svxid}.svx", url=url, notes=default_note, areacode=areacode, diff --git a/parsers/survex.py b/parsers/survex.py index e0d9835..f7b44f9 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -1202,8 +1202,7 @@ class LoadingSurvex: return self.caveslist[s] if cavepath[6:10] in ARGEAREAS: - url = f"/survexfile/{svxid}.svx" - return do_ARGE_cave(sluggy, caveid, url, area, svxid) + return do_ARGE_cave(sluggy, caveid, area, svxid) cave = create_new_cave(cavepath, f"Make cave found in survex file {svxid}") # uses the pending code to create pending cave descriptions self.caveslist[cavepath] = cave diff --git a/templates/cave.html b/templates/cave.html index f018ef4..3a791da 100644 --- a/templates/cave.html +++ b/templates/cave.html @@ -198,14 +198,14 @@ New Entrance

Survex File(s)

- All survexfiles for this cave
+ All survexfiles for this cave
{% if cave.survex_file %} Primary survex file for this cave
- Download .3d file caves-{{ cave.areacode }}/{{cave.kataster_number}}/{{svx3d}}.3d + Download .3d file caves-{{ cave.areacode }}/{% if cave.kataster_number %}{{cave.kataster_number}}{% else %}{{cave.unofficial_number}}{% endif %}/{{svx3d}}.3d
cave ID '{{cave.reference}}'
-cave survex path '{{ cave.areacode }}/{{cave.kataster_number}}' +cave survex path '{{ cave.areacode }}/{% if cave.kataster_number %}{{cave.kataster_number}}{% else %}{{cave.unofficial_number}}{% endif %}'
{% endif %} {% endblock content %} -- cgit v1.2.3