mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-16 05:47:11 +00:00
Logbook debugging
This commit is contained in:
@@ -57,7 +57,7 @@ LOGBOOK_PARSER_SETTINGS = {
|
|||||||
LOGBOOKS_DIR = "years" # subfolder of settings.EXPOWEB
|
LOGBOOKS_DIR = "years" # subfolder of settings.EXPOWEB
|
||||||
|
|
||||||
ENTRIES = {
|
ENTRIES = {
|
||||||
"2023": 1,
|
"2023": 11,
|
||||||
"2022": 90,
|
"2022": 90,
|
||||||
"2019": 55,
|
"2019": 55,
|
||||||
"2018": 95,
|
"2018": 95,
|
||||||
@@ -295,7 +295,7 @@ def parser_html(year, expedition, txt, seq=""):
|
|||||||
headmatch = re.match(r"(?i)(?s).*<body[^>]*>(.*?)<hr.*", txt)
|
headmatch = re.match(r"(?i)(?s).*<body[^>]*>(.*?)<hr.*", txt)
|
||||||
headpara = headmatch.groups()[0].strip()
|
headpara = headmatch.groups()[0].strip()
|
||||||
|
|
||||||
# print(f" - headpara:\n'{headpara}'")
|
#print(f" - headpara:\n'{headpara}'")
|
||||||
if len(headpara) > 0:
|
if len(headpara) > 0:
|
||||||
frontpath = Path(settings.EXPOWEB, LOGBOOKS_DIR, year, "frontmatter.html")
|
frontpath = Path(settings.EXPOWEB, LOGBOOKS_DIR, year, "frontmatter.html")
|
||||||
with open(frontpath, "w") as front:
|
with open(frontpath, "w") as front:
|
||||||
@@ -305,7 +305,7 @@ def parser_html(year, expedition, txt, seq=""):
|
|||||||
endmatch = re.match(r"(?i)(?s).*<hr\s*/>([\s\S]*?)(?=</body)", txt)
|
endmatch = re.match(r"(?i)(?s).*<hr\s*/>([\s\S]*?)(?=</body)", txt)
|
||||||
endpara = endmatch.groups()[0].strip()
|
endpara = endmatch.groups()[0].strip()
|
||||||
|
|
||||||
# print(f" - endpara:\n'{endpara}'")
|
#print(f" - endpara:\n'{endpara}'")
|
||||||
if len(endpara) > 0:
|
if len(endpara) > 0:
|
||||||
endpath = Path(settings.EXPOWEB, LOGBOOKS_DIR, year, "endmatter.html")
|
endpath = Path(settings.EXPOWEB, LOGBOOKS_DIR, year, "endmatter.html")
|
||||||
with open(endpath, "w") as end:
|
with open(endpath, "w") as end:
|
||||||
@@ -333,7 +333,7 @@ def parser_html(year, expedition, txt, seq=""):
|
|||||||
if s:
|
if s:
|
||||||
tripid, tripid1, tripdate, trippeople, triptitle, triptext, tu = s.groups()
|
tripid, tripid1, tripdate, trippeople, triptitle, triptext, tu = s.groups()
|
||||||
else: # allow title and people to be swapped in order
|
else: # allow title and people to be swapped in order
|
||||||
msg = f" !- {year} Can't parse:{logbook_entry_count} '{trippara[:50]}'..."
|
msg = f" !- {year} Can't parse:{logbook_entry_count} '{trippara[:55]}'...'{trippara}'"
|
||||||
print(msg)
|
print(msg)
|
||||||
DataIssue.objects.create(parser="logbooks", message=msg)
|
DataIssue.objects.create(parser="logbooks", message=msg)
|
||||||
|
|
||||||
@@ -353,7 +353,7 @@ def parser_html(year, expedition, txt, seq=""):
|
|||||||
tripid, tripid1, tripdate, triptitle, trippeople, triptext, tu = s2.groups()
|
tripid, tripid1, tripdate, triptitle, trippeople, triptext, tu = s2.groups()
|
||||||
else:
|
else:
|
||||||
# if not re.search(r"Rigging Guide", trippara):
|
# if not re.search(r"Rigging Guide", trippara):
|
||||||
msg = f" !- Logbook. Can't parse entry on 2nd pass:{logbook_entry_count} '{trippara[:50]}'..."
|
msg = f" !- Logbook. Can't parse entry on 2nd pass:{logbook_entry_count} '{trippara[:55]}'...'{trippara}'"
|
||||||
print(msg)
|
print(msg)
|
||||||
DataIssue.objects.create(parser="logbooks", message=msg)
|
DataIssue.objects.create(parser="logbooks", message=msg)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user