mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-02-17 20:50:13 +00:00
New SurvexDirectory report
This commit is contained in:
parent
8e2990ca7a
commit
8c721e905a
@ -18,7 +18,7 @@ from django.views.decorators.csrf import ensure_csrf_cookie
|
|||||||
import troggle.settings as settings
|
import troggle.settings as settings
|
||||||
from troggle.core.models.logbooks import LogbookEntry
|
from troggle.core.models.logbooks import LogbookEntry
|
||||||
from troggle.core.models.caves import Cave
|
from troggle.core.models.caves import Cave
|
||||||
from troggle.core.models.survex import SurvexFile, SurvexBlock
|
from troggle.core.models.survex import SurvexFile, SurvexBlock, SurvexDirectory
|
||||||
from troggle.core.models.wallets import Wallet
|
from troggle.core.models.wallets import Wallet
|
||||||
from troggle.core.utils import only_commit
|
from troggle.core.utils import only_commit
|
||||||
from troggle.parsers.survex import parse_one_file
|
from troggle.parsers.survex import parse_one_file
|
||||||
@ -642,6 +642,27 @@ def survexcaveslist(request):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def survexdir(request):
|
||||||
|
"""report on all the SurvexDirectory objects
|
||||||
|
We are trying to find out how mismatches have crept in.
|
||||||
|
"""
|
||||||
|
|
||||||
|
sds = SurvexDirectory.objects.all().order_by("cave")
|
||||||
|
for sd in sds:
|
||||||
|
sd.primarybad = True
|
||||||
|
if f"{sd.primarysurvexfile}".startswith(str(sd.path)):
|
||||||
|
sd.primarybad = False
|
||||||
|
|
||||||
|
sd.cavebad = True
|
||||||
|
munge = f"caves-{sd.cave}".lower()
|
||||||
|
if str(sd.path).lower().replace("/","-").startswith(munge):
|
||||||
|
sd.cavebad = False
|
||||||
|
|
||||||
|
sd.pathbad = True
|
||||||
|
if Path(settings.SURVEX_DATA, f"{sd.primarysurvexfile}.svx").is_file():
|
||||||
|
sd.pathbad = False
|
||||||
|
return render(request, "survexdir.html", {"survexdirs": sds})
|
||||||
|
|
||||||
|
|
||||||
def survexcavesingle(request, survex_cave):
|
def survexcavesingle(request, survex_cave):
|
||||||
"""parsing all the survex files of a single cave and showing that it's consistent and can find all
|
"""parsing all the survex files of a single cave and showing that it's consistent and can find all
|
||||||
|
@ -68,6 +68,8 @@ class SurvexLeg:
|
|||||||
def IdentifyCave(cavepath):
|
def IdentifyCave(cavepath):
|
||||||
"""Given a file path for a survex file, or a survex-block path,
|
"""Given a file path for a survex file, or a survex-block path,
|
||||||
return the cave object
|
return the cave object
|
||||||
|
|
||||||
|
This is clearly getting it badly wrong, see /survexdirs report.
|
||||||
"""
|
"""
|
||||||
caveslist = GetCaveLookup()
|
caveslist = GetCaveLookup()
|
||||||
if cavepath.lower() in caveslist:
|
if cavepath.lower() in caveslist:
|
||||||
@ -1171,6 +1173,8 @@ class LoadingSurvex:
|
|||||||
it sets the primarysurvexfile. This is correct as it should be set on the first file
|
it sets the primarysurvexfile. This is correct as it should be set on the first file
|
||||||
in the directory, where first is defined by the *include ordering. Which is what we
|
in the directory, where first is defined by the *include ordering. Which is what we
|
||||||
are doing.
|
are doing.
|
||||||
|
|
||||||
|
This does NOT set the current cave id in the SurvexDirectory, that happens later
|
||||||
"""
|
"""
|
||||||
if not headpath:
|
if not headpath:
|
||||||
return self.svxdirs[""]
|
return self.svxdirs[""]
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
<li><a href="/aliases/2023">Expoer name aliases</a> -short names recognised by troggle
|
<li><a href="/aliases/2023">Expoer name aliases</a> -short names recognised by troggle
|
||||||
<li><a href="/dataissues">Data Issues on Imports</a> - warnings and errors from the recent data import
|
<li><a href="/dataissues">Data Issues on Imports</a> - warnings and errors from the recent data import
|
||||||
<li><a href="/survexfilewild/2023">Wild survex files</a> - survex files contianing blocks with no related wallet
|
<li><a href="/survexfilewild/2023">Wild survex files</a> - survex files contianing blocks with no related wallet
|
||||||
|
<li><a href="/survexdir">Survex Directories</a> - Every Cave has an associated directory and a Primary survex file
|
||||||
<li><a href="/surveximport">Survex import record</a> - indented *include and begin/end tree<br /><li><a href="/survexdebug">Survex debug report</a> - warnings and details<br />
|
<li><a href="/surveximport">Survex import record</a> - indented *include and begin/end tree<br /><li><a href="/survexdebug">Survex debug report</a> - warnings and details<br />
|
||||||
<li><a href="/therionissues">Therion Import issues</a> - warnings from the recent data import<br /><br />
|
<li><a href="/therionissues">Therion Import issues</a> - warnings from the recent data import<br /><br />
|
||||||
<li><a href="/admin/">Django admin</a> - Deep magic access to all models and data
|
<li><a href="/admin/">Django admin</a> - Deep magic access to all models and data
|
||||||
|
22
templates/survexdir.html
Normal file
22
templates/survexdir.html
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<!-- svxcavesingle.html - this text visible because this template has been included -->
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% block title %}List of survex directories{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
{% autoescape off %}
|
||||||
|
<h1>SurvexDirectory objects</h1>
|
||||||
|
{% endautoescape %}
|
||||||
|
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr><th>Cave</th><th>CaveID</th><th>Path</th><th>Primary</th></tr>
|
||||||
|
{% for sd in survexdirs %}
|
||||||
|
<tr>
|
||||||
|
<td><span {% if sd.cavebad %} style="color:red" {% endif %}> {{sd.cave}}</span></td>
|
||||||
|
<td><em>{{sd.cave.id}}</em></td>
|
||||||
|
<td>{{sd.path}}</td>
|
||||||
|
<td><a href="/survexfile/{{sd.primarysurvexfile}}"><span {% if sd.pathbad %} style="color:red" {% endif %}>{{sd.primarysurvexfile}}.svx</span></a><span {% if sd.primarybad %} style="color:blue"> <b>MISMATCH</b> {% endif %}</span></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
2
urls.py
2
urls.py
@ -182,6 +182,8 @@ trogglepatterns = [
|
|||||||
path('controlpanel', controlpanel, name="controlpanel"),
|
path('controlpanel', controlpanel, name="controlpanel"),
|
||||||
|
|
||||||
# The survexfile pages
|
# The survexfile pages
|
||||||
|
path('survexdir', survex.survexdir, name="survexdir"),
|
||||||
|
|
||||||
path('survexfile', survex.survexcavesingle, {'survex_cave': ''}, name="survexcavessingle"),
|
path('survexfile', survex.survexcavesingle, {'survex_cave': ''}, name="survexcavessingle"),
|
||||||
path('survexfile/', survex.survexcavesingle, {'survex_cave': ''}, name="survexcavessingle"),
|
path('survexfile/', survex.survexcavesingle, {'survex_cave': ''}, name="survexcavessingle"),
|
||||||
path('survexfile/caves', survex.survexcaveslist, name="survexcaveslist"),
|
path('survexfile/caves', survex.survexcaveslist, name="survexcaveslist"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user