2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-02-08 09:26:47 +00:00

Ongoing work to remove SurvexDirectory as a concept

This commit is contained in:
2023-09-05 23:14:48 +03:00
parent 8c721e905a
commit cc9f425fb5
4 changed files with 41 additions and 22 deletions

View File

@@ -645,23 +645,30 @@ def survexcaveslist(request):
def survexdir(request):
"""report on all the SurvexDirectory objects
We are trying to find out how mismatches have crept in.
and whether the whole SUrvexDirectory class is actually redundant
as the info it holds is always embedded in the survexFile path directories
"""
sds = SurvexDirectory.objects.all().order_by("cave")
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.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})
survexfiles = SurvexFile.objects.all().order_by("cave")
# for f in survexfiles:
# if f.cave:
# print(f, f.cave)
return render(request, "survexdir.html", {"survexdirs": sds, "survexfiles": survexfiles})
def survexcavesingle(request, survex_cave):