2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-02-08 04:27:45 +00:00

apparently working, after *fix fiasco

This commit is contained in:
2026-01-29 12:29:01 +00:00
parent 8f4ad8e72f
commit c2818b4c97

View File

@@ -261,21 +261,6 @@ def hack_save(survexblock):
sb.save()
# #### Horrible hack to be properly written as a cache
def blockid_raw(survexfile, name):
if name and survexfile:
return f"{survexfile}-{name}"
return False
def blockid(survexblock):
"""When parsing all the survex file we need to maintain a number of caches as we want to
hit the database with updates only when we have collected all the data.
But since we have not saved to the database, we don't have a unique survexblock.id that we can
use. So we have to roll our own.
"""
return survexblock._blockid # new UUID
class LoadingSurvex:
"""A 'survex block' is a *begin...*end set of cave data.
A survex file can contain many begin-end blocks, which can be nested, and which can *include
@@ -578,13 +563,12 @@ class LoadingSurvex:
self.person_pending_cache[survexblock._blockid].add(tm)
print(f"-- person_pending_cache {survexblock}, {self.person_pending_cache[survexblock._blockid]}, {tm}")
def get_team_pending(self, survexblock):
def get_team_pending(self, blockid):
"""A set of *team names added at the end of the survex block
"""
if blockid in self.person_pending_cache:
teamnames = person_pending_cache[blockid] # a set of names
person_pending_cache[blockid] = set() #re zero the cache
teamnames = self.person_pending_cache[blockid] # a set of names
self.person_pending_cache[blockid] = set() #re zero the cache
return teamnames
return
@@ -856,7 +840,6 @@ class LoadingSurvex:
fixid = blockid(survexblock)
rx_fixline = re.compile(r"(?i)^\s*[*]fix\s+([\w\d_\.\-]+)\s+(?:reference)?\s*([\d\.]*)\s+([\d\.]*)\s+([\d\.]*)\s*;?(.*)$")
@@ -872,6 +855,7 @@ class LoadingSurvex:
#print(fixline.group(1), fixline.group(5))
#print(f"'{line}'")
name = fixdata[0]
fixid = f"{survexblock.survexfile.path}-{name}"
if fixid in self.fixes:
message = f"! Duplicate *FIX: id '{line}' '{fixid}' ({survexblock}) {survexblock.survexfile.path} "
print(self.insp + message)