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

moved pending team setting from *date to *end

This commit is contained in:
2026-01-29 13:50:31 +00:00
parent 647e8f5698
commit 7a779555ac

View File

@@ -972,7 +972,29 @@ class LoadingSurvex:
print(self.insp + message) print(self.insp + message)
stash_data_issue(parser='survex', message=message, url=None, sb=survexblock) stash_data_issue(parser='survex', message=message, url=None, sb=survexblock)
return expo return expo
def process_pending_team(self, survexblock):
expo = survexblock.expedition
if teamnames := self.get_team_pending(survexblock._blockid):
for tm in teamnames:
if known_foreigner(tm):
message = f"- *team {expo.year} '{tm}' known foreigner *date (misordered) {survexblock.survexfile.path} ({survexblock})"
print(self.insp + message)
# stash_data_issue(parser='survex', message=message, url=None, sb=survexblock)
else:
pe = GetPersonExpeditionNameLookup(expo).get(tm.lower())
if pe:
put_person_on_trip(survexblock, pe, tm)
else:
message = f"! *team {expo.year} '{tm}' FAIL personexpedition lookup on *date {survexblock.survexfile.path} ({survexblock}) "
print(self.insp + message)
stash_data_issue(
parser="survex",
message=message,
url=None, sb=survexblock,
)
def LoadSurvexDate(self, survexblock, line): def LoadSurvexDate(self, survexblock, line):
"""We now have a valid date for this survexblock, so we now know the expo """We now have a valid date for this survexblock, so we now know the expo
it relates to and can use GetPersonExpeditionNameLookup(expo) to check whether it relates to and can use GetPersonExpeditionNameLookup(expo) to check whether
@@ -990,7 +1012,7 @@ class LoadingSurvex:
caves-1623/161/triassic/henricat.svx has the *date after all the team members caves-1623/161/triassic/henricat.svx has the *date after all the team members
in each survexblock in each survexblock
""" """
def setdate_on_survexblock(year): def setdate_on_survexblock(year):
"""Either *date comes before any *team, in which case there are no prior """Either *date comes before any *team, in which case there are no prior
PersonRoles attached, or PersonRoles attached, or
@@ -1007,25 +1029,9 @@ class LoadingSurvex:
print(self.insp + message) print(self.insp + message)
stash_data_issue(parser='survex', message=message, url=None, sb=survexblock) stash_data_issue(parser='survex', message=message, url=None, sb=survexblock)
if teamnames := self.get_team_pending(survexblock._blockid): #self.process_pending_team(survexblock)
for tm in teamnames:
if known_foreigner(tm):
message = f"- *team {expo.year} '{tm}' known foreigner *date (misordered) {survexblock.survexfile.path} ({survexblock}) in '{line}'"
print(self.insp + message)
# stash_data_issue(parser='survex', message=message, url=None, sb=survexblock)
else:
pe = GetPersonExpeditionNameLookup(expo).get(tm.lower())
if pe:
put_person_on_trip(survexblock, pe, tm)
else:
message = f"! *team {year} '{tm}' FAIL personexpedition lookup on *date {survexblock.survexfile.path} ({survexblock}) "
print(self.insp + message)
stash_data_issue(
parser="survex",
message=message,
url=None, sb=survexblock,
)
oline = line oline = line
perps = get_people_on_trip(survexblock) # perps used for diagnostic error messages only: they are to blame perps = get_people_on_trip(survexblock) # perps used for diagnostic error messages only: they are to blame
@@ -1796,7 +1802,7 @@ class LoadingSurvex:
### HORRIBLE HACK, replace with cache ### HORRIBLE HACK, replace with cache
hack_save(survexblock) hack_save(survexblock)
### HORRIBLE HACK, replace with cache ### HORRIBLE HACK, replace with cache
try: try:
qm = QM.objects.create( qm = QM.objects.create(
@@ -2085,6 +2091,7 @@ class LoadingSurvex:
self.fix_undated(survexblock) self.fix_undated(survexblock)
self.fix_anonymous(survexblock) self.fix_anonymous(survexblock)
self.confirm_team_on_trip(survexblock) self.confirm_team_on_trip(survexblock)
self.process_pending_team(survexblock)
self.cache_survexblock(survexblock) self.cache_survexblock(survexblock)
# POP state ++++++++++++++ # POP state ++++++++++++++
popblock() popblock()
@@ -2153,9 +2160,6 @@ class LoadingSurvex:
print(f"FALLTHROUGH *{cmd=} {survexblock=} {survexblock.parent=}") print(f"FALLTHROUGH *{cmd=} {survexblock=} {survexblock.parent=}")
self.LoadSurvexFallThrough(survexblock, args, cmd) self.LoadSurvexFallThrough(survexblock, args, cmd)
# ...timing removed...
# this is a python generator idiom. # this is a python generator idiom.
# see https://realpython.com/introduction-to-python-generators/ # see https://realpython.com/introduction-to-python-generators/
# this is the first use of generators in troggle (Oct.2022) and saves 21 MB of memory # this is the first use of generators in troggle (Oct.2022) and saves 21 MB of memory
@@ -2195,11 +2199,10 @@ class LoadingSurvex:
self.slength = slengthtotal self.slength = slengthtotal
# At the end, save all cached survexblocks using bulk_update # At the end of the whole (concatenated) file, save all cached survexblocks using bulk_update
blocks = [] blocks = []
for blockid in self._pending_block_saves: for blockid in self._pending_block_saves:
blocks.append(self._pending_block_saves[blockid]) blocks.append(self._pending_block_saves[blockid])
# blocks = list(getattr(self, '_pending_block_saves', set()))
if blocks: if blocks:
# valid_blocks = [] # valid_blocks = []
# for block in blocks: # for block in blocks: