mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 16:51:54 +00:00
fix for non existent logbook between 1st Jan and start of expo
This commit is contained in:
parent
00f5ffa1b6
commit
6729698d7b
@ -59,7 +59,7 @@ LOGBOOK_PARSER_SETTINGS = {
|
||||
LOGBOOKS_DIR = "years" # subfolder of settings.EXPOWEB
|
||||
|
||||
ENTRIES = {
|
||||
"2024": 20,
|
||||
"2024": 27,
|
||||
"2023": 86,
|
||||
"2022": 94,
|
||||
"2019": 55,
|
||||
@ -580,6 +580,8 @@ def parse_logbook_for_expedition(expedition, blog=False):
|
||||
expedition.logbookfile = DEFAULT_LOGBOOK_FILE # don't change this if a blog
|
||||
parsefunc = DEFAULT_LOGBOOK_PARSER
|
||||
|
||||
logbookpath = Path(yearfile)
|
||||
|
||||
if blog:
|
||||
if year not in BLOG_PARSER_SETTINGS:
|
||||
message = f" ! - Expecting blog parser buut none specified for {year}"
|
||||
@ -588,15 +590,16 @@ def parse_logbook_for_expedition(expedition, blog=False):
|
||||
else:
|
||||
yearfile, parsefunc = BLOG_PARSER_SETTINGS[year]
|
||||
print(f" - BLOG file {yearfile} using parser {parsefunc}")
|
||||
|
||||
logbookpath = Path(yearfile)
|
||||
# print(f" - Logbook file {yearfile} using parser {parsefunc}")
|
||||
# expedition.save()
|
||||
else:
|
||||
lb = Path(expologbase, year, logbookpath.stem + logbookpath.suffix)
|
||||
if not (lb.is_file()):
|
||||
message = f" ! Logbook file does not exist (yet): '{lb}'"
|
||||
DataIssue.objects.create(parser="logbooks", message=message)
|
||||
print(message)
|
||||
|
||||
for sq in ["", "2", "3", "4"]: # cope with blog saved as many separate files
|
||||
lb = Path(expologbase, year, logbookpath.stem + sq + logbookpath.suffix)
|
||||
if not (lb.is_file()):
|
||||
# print(f" ! End of blog. Next blog file in sequence not there:{lb}")
|
||||
break
|
||||
try:
|
||||
with open(lb, "rb") as file_in:
|
||||
@ -706,7 +709,8 @@ def LoadLogbooks():
|
||||
if year in ENTRIES:
|
||||
loglist.append(expo)
|
||||
else:
|
||||
print(" - No Logbook yet for: " + year) # catch case when preparing for next expo
|
||||
print(" - No Logbook entries count yet for: " + year) # catch case when preparing for next expo
|
||||
loglist.append(expo)
|
||||
|
||||
if year in BLOG_PARSER_SETTINGS:
|
||||
bloglist.append(expo)
|
||||
|
Loading…
Reference in New Issue
Block a user