diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-09-05 21:46:10 +0300 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-09-05 21:46:10 +0300 |
commit | 8c721e905ad1276b510ad266bd54eb0d8b489038 (patch) | |
tree | 3531695bcbafbeb67679cba5012f4024b5aa7be1 /core/views/survex.py | |
parent | 8e2990ca7a2c08031d8434e138edc77df3229818 (diff) | |
download | troggle-8c721e905ad1276b510ad266bd54eb0d8b489038.tar.gz troggle-8c721e905ad1276b510ad266bd54eb0d8b489038.tar.bz2 troggle-8c721e905ad1276b510ad266bd54eb0d8b489038.zip |
New SurvexDirectory report
Diffstat (limited to 'core/views/survex.py')
-rw-r--r-- | core/views/survex.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/core/views/survex.py b/core/views/survex.py index 3ab7dd9..7ac206a 100644 --- a/core/views/survex.py +++ b/core/views/survex.py @@ -18,7 +18,7 @@ from django.views.decorators.csrf import ensure_csrf_cookie import troggle.settings as settings from troggle.core.models.logbooks import LogbookEntry 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.utils import only_commit 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): """parsing all the survex files of a single cave and showing that it's consistent and can find all |