From e080610010917e1865df5fb612f7c3011ad7f9e0 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Fri, 31 Jan 2025 00:37:20 +0000 Subject: [PATCH] More diagnostics --- core/views/cave_kataster.py | 16 +++++++++++++--- templates/cave_kataster.html | 29 ++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/core/views/cave_kataster.py b/core/views/cave_kataster.py index 161c13f..08aced6 100644 --- a/core/views/cave_kataster.py +++ b/core/views/cave_kataster.py @@ -31,9 +31,9 @@ def kataster(request, slug): return HttpResponseRedirect("/caves") knum = 9999 - cavename = str(cave) + ".html" + filename = str(cave) + ".html" - cave_data = Path( "cave_data", cavename ) + cave_data = Path( "cave_data", filename ) if not (settings.EXPOWEB / cave_data).is_file: cave_data = "does not exist" @@ -44,7 +44,16 @@ def kataster(request, slug): if str(ent.name).startswith(str(cave)): print(ent.name) entrance_data.append("entrance_data/"+ent.name) - + + loser_name = f"caves-{str(cave.areacode)}/{str(cave.unofficial_number)}" + loser_dir = settings.SURVEX_DATA / loser_name + loser_data = [] + if (loser_dir).is_dir(): + print(loser_dir) + for svx in loser_dir.iterdir(): + print(svx) + loser_data.append(Path(loser_dir , svx).name) + if request.method == "POST": # If the form has been submitted... form = KatasterForm(request.POST) # A form bound to the POST data if form.is_valid(): @@ -61,6 +70,7 @@ def kataster(request, slug): "form": form, "cave": cave, "cave_data": cave_data, "entrance_data": entrance_data, + "loser_name": loser_name, "loser_data": loser_data, "knum": knum, }, ) diff --git a/templates/cave_kataster.html b/templates/cave_kataster.html index 0dd99a3..7273371 100644 --- a/templates/cave_kataster.html +++ b/templates/cave_kataster.html @@ -27,7 +27,7 @@ This cave needs to be "katastered". If you have the new number issued by the Aus {% endif %} -

Rename the .html files

+

Rename the .html files in expoweb

{{cave_data|safe}}

@@ -43,13 +43,21 @@ This cave needs to be "katastered". If you have the new number issued by the Aus

  • Rename all the files listed above - always do this last otherwise it is hard to automatically discover which edits have not been done. -

    Rename the cave description directory

    +

    Rename the cave description directory in expoweb

    • Edit all the 'href=' URLS (if they exist) inside all the cave_data and entrance_data files descriptive text to refer to the new directory
    • Rename the directory (if it exists) inside the areacode directory, e.g. rename /{{cave.areacode}}/{{cave.unofficial_number}}/ as /{{cave.areacode}}/{{knum}}/ (if {{knum}} is the correct new kataster number). Do this last.
    -

    Rename the survex directory

    + +

    Rename the survex directory in loser

    +
    +{{loser_name|safe}}/ +

    +{% for f in loser_data %} +   {{f|safe}}
    +{% endfor %} +

    • Find the survex files for this cave and edit the *include inside the survex files to use the new kataster number
    • find and edit the '*_station' tags in each entrance_data file and in the fixed points files in the loser repo. @@ -58,10 +66,18 @@ This cave needs to be "katastered". If you have the new number issued by the Aus
    • Run 'cavern caves-{{cave.areacode |safe}}/caves.svx' and check it all works as you hope
    -

    Set the historic alias forwarder

    + +

    Sort out the *fix point(s) in both loser and in expoweb

    +
      +
    • Find the *fix point for each entrance (one or more in each entrance_data file) in expoweb +
    • Change the name of each *fix point in the relevant survex file in loser +
    • Make the same name change(s) in each entrance file (in each entrance_data file) in expoweb +
    + +

    Set the historic alias forwarder in expoweb

    Finally

      @@ -83,4 +99,7 @@ git push
      (in fact, look at this before you do any of this, so you can see what chnages.)
    +

    Ideal scenario

    +

    +

    Ideally you do this renumbering on a standalone instance of troggle running on a troggle development laptop and you don't push any of the git commits to the server until you have got all the niggles out of the conversion, i.e. the databaseReset runs locally without any warnings or errors introduced by your renaming and 'cavern' runs without any new survex errors. {% endblock %}