summaryrefslogtreecommitdiffstats
path: root/parsers/survex.py
diff options
context:
space:
mode:
Diffstat (limited to 'parsers/survex.py')
-rw-r--r--parsers/survex.py36
1 files changed, 27 insertions, 9 deletions
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