From cc9f425fb5fa82ac26db4f14c4c484fb7fd85cf6 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Tue, 5 Sep 2023 23:14:48 +0300 Subject: Ongoing work to remove SurvexDirectory as a concept --- core/views/survex.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'core/views/survex.py') diff --git a/core/views/survex.py b/core/views/survex.py index 7ac206a..bd9df25 100644 --- a/core/views/survex.py +++ b/core/views/survex.py @@ -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): -- cgit v1.2.3