diff --git a/parsers/logbooks.py b/parsers/logbooks.py index dabc701..b94f597 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -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, @@ -579,6 +579,8 @@ def parse_logbook_for_expedition(expedition, blog=False): yearfile = DEFAULT_LOGBOOK_FILE 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: @@ -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,8 +709,9 @@ 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)