mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
tidy
This commit is contained in:
parent
6b64149131
commit
6d5cee7f6a
@ -27,18 +27,13 @@ from troggle.parsers.survex import parse_one_file
|
||||
but also displays data on a cave or caves when there is ambiguity
|
||||
"""
|
||||
|
||||
todo = """- survexcavesingle is not properly producing any result for Homecoming, 1626-359, 2018-dm-07
|
||||
even though there are dozens of surveys.
|
||||
|
||||
todo = """
|
||||
- filter out the non-public caves from display UNLESS LOGGED IN
|
||||
|
||||
- Never actual uses the object for the survexfile, works entirely from the filepath! Make it check and validate
|
||||
|
||||
- the primary survex file in each cave directory should be in a configuration? not buried in the code
|
||||
and implicit in the order of *import statements ?
|
||||
|
||||
- Save and re-parse an edited survexfile which already exists in the db, and update
|
||||
all its dependencies (work in progress)
|
||||
and implicit in the order of *import statements ? It is in the cave_data file.
|
||||
|
||||
- overlapping and cross-calling when things fail make this hard to undersand, e.g. svx() and
|
||||
survexcavessingle() can get called for a survex file depending on whether the URL ends in ".svx" or not,
|
||||
@ -648,23 +643,9 @@ 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
|
||||
"""report on all the primary survex files, per cave and per directory
|
||||
"""
|
||||
|
||||
# sds = SurvexDirectory.objects.all() #.order_by("cave")
|
||||
sds ={}
|
||||
# for sd in sds:
|
||||
# sd.matchbad = True
|
||||
# if f"{sd.primarysurvexfile}".startswith(str(sd.path)):
|
||||
# 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:
|
||||
f.pathbad = True
|
||||
@ -692,11 +673,6 @@ def survexcavesingle(request, cave_shortname):
|
||||
cave.sds = get_primaries(cave)
|
||||
return render(request, "svxcaves.html", {"settings": settings, "caves": [cave]})
|
||||
else:
|
||||
# not a cave or an ambiguous short name, e.g. "122"
|
||||
|
||||
# if (SVXPATH / Path(cave_shortname + ".svx")).is_file():
|
||||
# return svx(request, cave_shortname)
|
||||
|
||||
caves = Cave.objects.filter(kataster_number=cave_shortname)
|
||||
if len(caves) > 0:
|
||||
# print(f"many {cave_shortname=} => {caves=}")
|
||||
|
@ -2340,7 +2340,7 @@ def parse_one_file(fpath): # --------------------------------------in progress--
|
||||
This all needs refactoring.
|
||||
|
||||
We also need to re-plumb the fileroot after importing, so that
|
||||
the new survexfile appears in the survexdirectory lists
|
||||
the new survexfile appears in the survexdirectory lists?
|
||||
"""
|
||||
if svxfileroot == None:
|
||||
svxfileroot = MakeFileRoot(fpath)
|
||||
@ -2369,12 +2369,9 @@ def parse_one_file(fpath): # --------------------------------------in progress--
|
||||
# Now we don't need or want the dummy any more
|
||||
block_dummy.delete()
|
||||
|
||||
#svxfile.survexdirectory =
|
||||
|
||||
global svx_load
|
||||
print(f"\n - Loading One Survex file '{fpath}'", file=sys.stderr)
|
||||
svx_load = LoadingSurvex()
|
||||
#svx_load.survexdict = {}
|
||||
|
||||
fname = Path(settings.SURVEX_DATA, (fpath + ".svx"))
|
||||
|
||||
@ -2441,15 +2438,6 @@ def parse_one_file(fpath): # --------------------------------------in progress--
|
||||
parse_new_svx(fpath,svx_load)
|
||||
#===========
|
||||
|
||||
# print(f" - Number of SurvexDirectories: {len(svx_load.survexdict):,}")
|
||||
# tf = 0
|
||||
# for d in svx_load.survexdict:
|
||||
# print(f" - SD: {d}")
|
||||
# tf += len(svx_load.survexdict[d])
|
||||
# print(f" - Number of SurvexFiles: {tf:,}")
|
||||
# print(f" - Number of Survex legs: {svx_load.legsnumber:,}")
|
||||
# print(f" - Length of Survex legs: {svx_load.slength:.2f} m")
|
||||
|
||||
svx_load = None
|
||||
return True
|
||||
|
||||
@ -2460,12 +2448,6 @@ def MakeSurvexFileRoot():
|
||||
|
||||
fileroot = SurvexFile(path=settings.SURVEX_TOPNAME, cave=None)
|
||||
fileroot.save()
|
||||
#directoryroot = SurvexDirectory(path=settings.SURVEX_DATA, primarysurvexfile=fileroot)
|
||||
# MariaDB doesn't like this hack. Complains about non-null cave_id EVEN THOUGH our model file says this is OK:
|
||||
# cave = models.ForeignKey('Cave', blank=True, null=True,on_delete=models.SET_NULL)
|
||||
#directoryroot.save()
|
||||
#fileroot.survexdirectory = directoryroot # i.e. SURVEX_DATA/SURVEX_TOPNAME
|
||||
#fileroot.save() # mutually dependent objects need a double-save like this
|
||||
return fileroot
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user