summaryrefslogtreecommitdiffstats
path: root/core/views/survex.py
diff options
context:
space:
mode:
Diffstat (limited to 'core/views/survex.py')
-rw-r--r--core/views/survex.py30
1 files changed, 19 insertions, 11 deletions
diff --git a/core/views/survex.py b/core/views/survex.py
index 3ecd523..10ebbd0 100644
--- a/core/views/survex.py
+++ b/core/views/survex.py
@@ -563,7 +563,11 @@ def get_survexareapath(area):
def survexcaveslist(request):
"""This reads the entire list of caves in the Loser repo directory and produces a complete report.
It can find caves which have not yet been properly registered in the system by Databasereset.py because
- someone may have uploaded the survex files without doing the rest of the integration process.
+ someone may have uploaded the survex files with git without doing the rest of the integration process.
+
+ But maybe we don't care if someone has done that!
+ In which case we don't need any of this reading the filesystem, we can generate it all from
+ what is already in the db, and just construct: onefilecaves, multifilecaves, subdircaves.
It uses very impenetrable code in identifycavedircontents()
"""
@@ -651,23 +655,27 @@ def survexdir(request):
sds = SurvexDirectory.objects.all() #.order_by("cave")
for sd in sds:
- sd.primarybad = True
+ sd.matchbad = 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.matchbad = False
sd.pathbad = True
if Path(settings.SURVEX_DATA, f"{sd.primarysurvexfile}.svx").is_file():
sd.pathbad = False
survexfiles = SurvexFile.objects.all().order_by("cave")
- # for f in survexfiles:
- # if f.cave:
- # print(f, f.cave)
+ for f in survexfiles:
+ f.matchbad = True
+ if f"{f.path}".startswith(str(f.survexdirectory.path)):
+ f.matchbad = False
+ f.primarybad = True
+ if f.primary:
+ f.pathparent = Path(f.primary.path).parent
+ if str(f.survexdirectory.path) == str(f.pathparent):
+ f.primarybad = False
+ f.pathbad = True
+ if Path(settings.SURVEX_DATA, f"{f.path}.svx").is_file():
+ f.pathbad = False
return render(request, "survexdir.html", {"survexdirs": sds, "survexfiles": survexfiles})
def get_directories(cave):