2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 22:07:03 +00:00
This commit is contained in:
2023-09-11 22:42:12 +03:00
parent d323ff2700
commit af136d3432
3 changed files with 11 additions and 10 deletions

View File

@@ -111,7 +111,7 @@ def create_new_cave(svxpath, msg=None):
# e.g. svxpath = "caves-1623/666/beast" .svx # e.g. svxpath = "caves-1623/666/beast" .svx
print(f"Create new cave at {svxpath} - {msg}") print(f"Create new cave at {svxpath} - {msg}")
# #
survex_file = svxpath + ".svx" survex_file = svxpath.replace("caves-","") + ".svx"
parts = svxpath.split("/") parts = svxpath.split("/")
a = parts[0][-4:] a = parts[0][-4:]
caveid = parts[1] caveid = parts[1]
@@ -149,11 +149,13 @@ def create_new_cave(svxpath, msg=None):
cave.save() cave.save()
return cave 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. """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. 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 the survex file.
We already know that the cave doesn't exist... though there are bugs.. 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" 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() line2 = s.readline()
line3 = s.readline() line3 = s.readline()
else: else:
print(f"not correct {sv}", file=sys.stderr) print(f"not correct svxid {svxid} {sv}", file=sys.stderr)
cave = Cave( cave = Cave(
underground_description="ARGE cave.\n3 lines of the survexfile:\n" + line1 +line2 +line3, underground_description="ARGE cave.<br>3 lines of the survexfile:<br><pre>" + line1 +line2 +line3 +"</pre>",
unofficial_number="ARGE", unofficial_number="ARGE",
survex_file= svxurl, survex_file= f"{svxid}.svx",
url=url, url=url,
notes=default_note, notes=default_note,
areacode=areacode, areacode=areacode,

View File

@@ -1202,8 +1202,7 @@ class LoadingSurvex:
return self.caveslist[s] return self.caveslist[s]
if cavepath[6:10] in ARGEAREAS: if cavepath[6:10] in ARGEAREAS:
url = f"/survexfile/{svxid}.svx" return do_ARGE_cave(sluggy, caveid, area, svxid)
return do_ARGE_cave(sluggy, caveid, url, area, svxid)
cave = create_new_cave(cavepath, f"Make cave found in survex file {svxid}") # uses the pending code to create pending cave descriptions 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 self.caveslist[cavepath] = cave

View File

@@ -198,14 +198,14 @@
<a class="editlink" href="{% if local %}https://expo.survex.com{% endif %}{% url "newentrance" cave.url_parent cave.slug %}">New Entrance</a> <a class="editlink" href="{% if local %}https://expo.survex.com{% endif %}{% url "newentrance" cave.url_parent cave.slug %}">New Entrance</a>
</div> </div>
<h2>Survex File(s)</h2> <h2>Survex File(s)</h2>
All <a href="/survexfile/{{ cave.areacode }}-{{cave.kataster_number}}">survexfiles</a> for this cave <br /> All <a href="/survexfile/{{ cave.areacode }}-{% if cave.kataster_number %}{{cave.kataster_number}}{% else %}{{cave.unofficial_number}}{% endif %}">survexfiles</a> for this cave <br />
{% if cave.survex_file %} {% if cave.survex_file %}
Primary <a href="/survexfile/{{cave.survex_file}}">survex file</a> for this cave Primary <a href="/survexfile/{{cave.survex_file}}">survex file</a> for this cave
<br> <br>
Download .3d file <a href="{% url "cave3d" cave %}">caves-{{ cave.areacode }}/{{cave.kataster_number}}/{{svx3d}}.3d</a> Download .3d file <a href="{% url "cave3d" cave %}">caves-{{ cave.areacode }}/{% if cave.kataster_number %}{{cave.kataster_number}}{% else %}{{cave.unofficial_number}}{% endif %}/{{svx3d}}.3d</a>
<br> <br>
cave ID '{{cave.reference}}'<br> cave ID '{{cave.reference}}'<br>
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 %}'
<div id='scene'></div> <div id='scene'></div>
{% endif %} {% endif %}
{% endblock content %} {% endblock content %}