mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-02-08 07:28:45 +00:00
apparently working, after *fix fiasco
This commit is contained in:
@@ -261,21 +261,6 @@ def hack_save(survexblock):
|
|||||||
sb.save()
|
sb.save()
|
||||||
# #### Horrible hack to be properly written as a cache
|
# #### 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:
|
class LoadingSurvex:
|
||||||
"""A 'survex block' is a *begin...*end set of cave data.
|
"""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
|
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)
|
self.person_pending_cache[survexblock._blockid].add(tm)
|
||||||
print(f"-- person_pending_cache {survexblock}, {self.person_pending_cache[survexblock._blockid]}, {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
|
"""A set of *team names added at the end of the survex block
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if blockid in self.person_pending_cache:
|
if blockid in self.person_pending_cache:
|
||||||
teamnames = person_pending_cache[blockid] # a set of names
|
teamnames = self.person_pending_cache[blockid] # a set of names
|
||||||
person_pending_cache[blockid] = set() #re zero the cache
|
self.person_pending_cache[blockid] = set() #re zero the cache
|
||||||
return teamnames
|
return teamnames
|
||||||
return
|
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*;?(.*)$")
|
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(fixline.group(1), fixline.group(5))
|
||||||
#print(f"'{line}'")
|
#print(f"'{line}'")
|
||||||
name = fixdata[0]
|
name = fixdata[0]
|
||||||
|
fixid = f"{survexblock.survexfile.path}-{name}"
|
||||||
if fixid in self.fixes:
|
if fixid in self.fixes:
|
||||||
message = f"! Duplicate *FIX: id '{line}' '{fixid}' ({survexblock}) {survexblock.survexfile.path} "
|
message = f"! Duplicate *FIX: id '{line}' '{fixid}' ({survexblock}) {survexblock.survexfile.path} "
|
||||||
print(self.insp + message)
|
print(self.insp + message)
|
||||||
|
|||||||
Reference in New Issue
Block a user