diff --git a/parsers/logbooks.py b/parsers/logbooks.py index ef2668a..c9d2d39 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -54,12 +54,12 @@ DEFAULT_LOGBOOK_PARSER = "parser_html" # All years now (Jan.2023) use the default value for Logbook parser # dont forget to update expoweb/pubs.htm to match. 1982 left as reminder of expected format. LOGBOOK_PARSER_SETTINGS = { - "1982": ("logbook.html", "parser_html"), + "1982": ("logbook.html", "parser_html"), } LOGBOOKS_DIR = "years" # subfolder of settings.EXPOWEB ENTRIES = { - "2024": 69, + "2024": 87, "2023": 131, "2022": 94, "2019": 55, diff --git a/parsers/survex.py b/parsers/survex.py index 28a2467..45712f6 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -2655,9 +2655,27 @@ def parse_one_file(fpath): # --------------------------------------in progress-- def set_survexblocks(): - """Need to find the optimal Django way of doing this query. - It's a mess now""" + """This sets the links directly to each survexblock. + NB ARGE inserts survexblocks from several different expeditions into one survexfile + Also a survex block e.g. "1623" will include lots of different expeditons + from models/survex.py: + + name = models.CharField(max_length=100) ..often blank, no #NoName.. + date = models.DateField( ..inherited + title = models.CharField(max_length=200) ..inherited + parent = models.ForeignKey("SurvexBlock" + + expedition = models.ForeignKey("Expedition", + survexfile = models.ForeignKey("SurvexFile", + scanswallet = models.ForeignKey("Wallet", + + legsall = models.IntegerField(null=True) + legslength = models.FloatField(null=True) + """ + + # Need to find the optimal Django way of doing this query. + # It's a mess now # for b in SurvexBlock.objects.all(): # if not b.date: # print(f" Block {b} on {b.survexfile} HAS NULL DATE ") @@ -2686,17 +2704,17 @@ def set_survexblocks(): # continue blocks = SurvexBlock.objects.filter(survexfile=sfile) for b in blocks: - if b.date: # many are NULL + if b.date: # many are NULL, e.g. ARGE, so have no wallet if b.scanswallet == wallet: pass elif b.scanswallet: - if b.date > date(2019, 1, 1) and b.date < date(2020, 1, 1): - print(f"not set{wallet} on {b.survexfile} : {b} as already set to {b.scanswallet}") + if b.date > date(2024, 1, 1) and b.date < date(2025, 1, 1): + print(f"2019 not set{wallet} on {b.survexfile} for block {b} as set explicitly to {b.scanswallet}") else: - b.scanswallet = wallet - b.save() - if b.date > date(2019, 1, 1) and b.date < date(2020, 1, 1): - print(f"setting {wallet} on {b.survexfile} : {b}") + b.scanswallet = wallet + b.save() + if b.date > date(2024, 1, 1) and b.date < date(2025, 1, 1): + print(f"2019 setting {wallet} on {b.survexfile} for block {b}") def survexifywallets(): """Gets the caves from the list of survexblocks