2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-14 18:07:22 +00:00

make more robust against data error

This commit is contained in:
2025-02-19 18:32:58 +02:00
parent a950cc60d9
commit aeaf7cf57f
4 changed files with 18 additions and 11 deletions

View File

@@ -268,7 +268,7 @@ class JobQueue:
self.results["TOTAL"] = []
for i in range(len(self.results["date"])):
self.format_date(i)
print(i, self.compute_total(i))
# print(i, self.compute_total(i))
self.results["TOTAL"].append(self.compute_total(i))
for j in self.results_order:

View File

@@ -58,7 +58,7 @@ LOGBOOK_PARSER_SETTINGS = {
LOGBOOKS_DIR = "years" # subfolder of settings.EXPOWEB
ENTRIES = {
"2024": 125,
"2024": 126,
"2023": 131,
"2022": 94,
"2019": 55,
@@ -66,7 +66,7 @@ ENTRIES = {
"2017": 74,
"2016": 87,
"2015": 80,
"2014": 67,
"2014": 68,
"2013": 52,
"2012": 76,
"2011": 71,

View File

@@ -137,10 +137,15 @@ def load_people_expos():
nick = ""
rawlastname = personline[header["Lastname"]].strip()
matchlastname = re.match(r"^([\w&;\s]+)(?:\(([^)]*)\))?", rawlastname)
lastname = matchlastname.group(1).strip()
if rawlastname == "":
print(f"MISSING SURNAME FIELD for {name} - check against similar names in the list to see what you have done.")
if matchlastname := re.match(r"^([\w&;\s]+)(?:\(([^)]*)\))?", rawlastname):
lastname = matchlastname.group(1).strip()
else:
print(f"MATCH FAIL {personline=}\n {slug=}\n {name=}\n {rawlastname=}")
exit(1)
splitnick = re.match(r"^([\w&;\s]+)(?:\(([^)]*)\))?", plainname)
splitnick = re.match(r"^([\w&;\s\-]+)(?:\(([^)]*)\))?", plainname)
fullname = splitnick.group(1) # removes Nickname in brackets, but also cuts hyphenated names
nick = splitnick.group(2) or ""

View File

@@ -22,6 +22,12 @@ It also scans the Loser repo for all the svx files, which it loads individually
"""
todo = """
- Rewrite regexes to use .groupdict instead of .group,
easier to understand and maintain
https://mathspp.com/blog/til/re-match-groupdict
- replace hard-coded instuments list with reding an editable textfile in expoweb.
- Obscure bug in the *team inheritance and rootblock initialization needs tracking down,
probably in the team cache which should NOT be global, but should be an instance variable of
LoadingSurvex
@@ -75,10 +81,6 @@ class SurvexLeg:
clino = 0.0
def datewallet(w, earliest):
"""Gets the date of the youngest survexblock associated with the wallet
REFACTOR this to do the whole date-getting task
@@ -163,7 +165,7 @@ def get_people_on_trip(survexblock):
return list(set(people))
# THIS SHOULD NOT BE GLOBAL ! SHould be per instance of file loader
# THIS SHOULD NOT BE GLOBAL ! Should be per instance of file loader
trip_person_record = {} # indexed by (survexblock, personexpedition) - so never needs cleaning out
trip_team_cache = {} # indexed by survexblock, so never needs cleaning out
def put_person_on_trip(survexblock, personexpedition, tm):