mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +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
|
LOGBOOKS_DIR = "years" # subfolder of settings.EXPOWEB
|
||||||
|
|
||||||
ENTRIES = {
|
ENTRIES = {
|
||||||
"2024": 20,
|
"2024": 27,
|
||||||
"2023": 86,
|
"2023": 86,
|
||||||
"2022": 94,
|
"2022": 94,
|
||||||
"2019": 55,
|
"2019": 55,
|
||||||
@ -579,6 +579,8 @@ def parse_logbook_for_expedition(expedition, blog=False):
|
|||||||
yearfile = DEFAULT_LOGBOOK_FILE
|
yearfile = DEFAULT_LOGBOOK_FILE
|
||||||
expedition.logbookfile = DEFAULT_LOGBOOK_FILE # don't change this if a blog
|
expedition.logbookfile = DEFAULT_LOGBOOK_FILE # don't change this if a blog
|
||||||
parsefunc = DEFAULT_LOGBOOK_PARSER
|
parsefunc = DEFAULT_LOGBOOK_PARSER
|
||||||
|
|
||||||
|
logbookpath = Path(yearfile)
|
||||||
|
|
||||||
if blog:
|
if blog:
|
||||||
if year not in BLOG_PARSER_SETTINGS:
|
if year not in BLOG_PARSER_SETTINGS:
|
||||||
@ -588,15 +590,16 @@ def parse_logbook_for_expedition(expedition, blog=False):
|
|||||||
else:
|
else:
|
||||||
yearfile, parsefunc = BLOG_PARSER_SETTINGS[year]
|
yearfile, parsefunc = BLOG_PARSER_SETTINGS[year]
|
||||||
print(f" - BLOG file {yearfile} using parser {parsefunc}")
|
print(f" - BLOG file {yearfile} using parser {parsefunc}")
|
||||||
|
else:
|
||||||
logbookpath = Path(yearfile)
|
lb = Path(expologbase, year, logbookpath.stem + logbookpath.suffix)
|
||||||
# print(f" - Logbook file {yearfile} using parser {parsefunc}")
|
if not (lb.is_file()):
|
||||||
# expedition.save()
|
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
|
for sq in ["", "2", "3", "4"]: # cope with blog saved as many separate files
|
||||||
lb = Path(expologbase, year, logbookpath.stem + sq + logbookpath.suffix)
|
lb = Path(expologbase, year, logbookpath.stem + sq + logbookpath.suffix)
|
||||||
if not (lb.is_file()):
|
if not (lb.is_file()):
|
||||||
# print(f" ! End of blog. Next blog file in sequence not there:{lb}")
|
|
||||||
break
|
break
|
||||||
try:
|
try:
|
||||||
with open(lb, "rb") as file_in:
|
with open(lb, "rb") as file_in:
|
||||||
@ -706,8 +709,9 @@ def LoadLogbooks():
|
|||||||
if year in ENTRIES:
|
if year in ENTRIES:
|
||||||
loglist.append(expo)
|
loglist.append(expo)
|
||||||
else:
|
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:
|
if year in BLOG_PARSER_SETTINGS:
|
||||||
bloglist.append(expo)
|
bloglist.append(expo)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user