2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 06:57:12 +00:00

moving primary survex file to each survexfile

This commit is contained in:
2023-09-06 17:19:20 +03:00
parent 3c6cae20ed
commit 0dc0e27519
7 changed files with 64 additions and 47 deletions

View File

@@ -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):