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

bug fi, always need to regenerate the import .pos file

This commit is contained in:
2025-07-08 16:58:27 +03:00
parent 6c962c0132
commit 4b4ab973f8
2 changed files with 25 additions and 20 deletions

View File

@@ -149,6 +149,7 @@ def validate_entrance_stations(ent=None):
elif len(cavelist) > 1:
cave = cavelist[-1] # set to last in list
url = f"/{cave.url}"
print(f"WARNING more than one cave '{cavelist}' on Entrance object {ent} ")
else:
print(f"BUGGER bad cave '{cavelist}' on Entrance object {ent} ")
url="/caves"
@@ -172,7 +173,7 @@ def validate_entrance_stations(ent=None):
message =f"{so.count()} found for Entrance {ent} '{ent_type}' station '{st}' {so}"
else:
# not found
message = f" ! - Entrance {ent} has invalid '{ent_type}' station '{st}'"
message = f" ! - Entrance {ent} '{ent_type}' station '{st}' not found as a registered SurvexStation"
if st == ent.best_station():
message = message + " - AND THIS IS THE 'BEST' ONE"
else:
@@ -289,26 +290,27 @@ def LoadPositions():
d3dpath = topdata.with_suffix(".3d")
pospath = topdata.with_suffix(".pos")
if not settings.DEVSERVER:
runcavern3d(f"Regen - on server {settings.DEVSERVER=}") # always regenerate .3d and .pos on the server
else:
# These basic tests fail to capture the case where a *included svx file has changed,
# typically this is one of the fixedpts *fix files.
for p in [pospath, d3dpath]:
if not p.is_file():
runcavern3d(f"Creating {p}.3d, .pos")
svx_t = svxpath.stat().st_mtime
d3d_t = d3dpath.stat().st_mtime # os.path.getmtime(d3dpath)
svx_d = datetime.fromtimestamp(svx_t).strftime('%d %b %Y %H:%M:%S')
d3d_d = datetime.fromtimestamp(d3d_t).strftime('%d %b %Y %H:%M:%S')
runcavern3d(f"Regen {settings.DEVSERVER=}") # always regenerate .3d and .pos as the *includes may have changed
# if not settings.DEVSERVER:
# runcavern3d(f"Regen - on server {settings.DEVSERVER=}") # always regenerate .3d and .pos on the server
# else:
# # These basic tests fail to capture the case where a *included svx file has changed,
# # typically this is one of the fixedpts *fix files.
# for p in [pospath, d3dpath]:
# if not p.is_file():
# runcavern3d(f"Creating {p}.3d, .pos")
# svx_t = svxpath.stat().st_mtime
# d3d_t = d3dpath.stat().st_mtime # os.path.getmtime(d3dpath)
# svx_d = datetime.fromtimestamp(svx_t).strftime('%d %b %Y %H:%M:%S')
# d3d_d = datetime.fromtimestamp(d3d_t).strftime('%d %b %Y %H:%M:%S')
now = time.time()
if d3d_t - svx_t < 0: # stale, 3d older than svx file . But .svx timestamp does not reflect *include timestamps
runcavern3d(f"Regen - stale {d3d_d} earlier than {svx_d}")
elif now - d3d_t > 24 * 60 * 60: # >1 days old, re-run anyway
runcavern3d(f"Regen - old")
elif d3d_t - cav_t < 0: # new version of cavern
runcavern3d(f"Regen - new survex version {d3d_d} earlier than {cav_d} ")
# now = time.time()
# if d3d_t - svx_t < 0: # stale, 3d older than svx file . But .svx timestamp does not reflect *include timestamps
# runcavern3d(f"Regen - stale {d3d_d} earlier than {svx_d}")
# elif now - d3d_t > 24 * 60 * 60: # >1 days old, re-run anyway
# runcavern3d(f"Regen - old")
# elif d3d_t - cav_t < 0: # new version of cavern
# runcavern3d(f"Regen - new survex version {d3d_d} earlier than {cav_d} ")
mappoints = {}
found_points = {}