summaryrefslogtreecommitdiffstats
path: root/parsers
diff options
context:
space:
mode:
Diffstat (limited to 'parsers')
-rw-r--r--parsers/imports.py2
-rw-r--r--parsers/survex.py13
2 files changed, 15 insertions, 0 deletions
diff --git a/parsers/imports.py b/parsers/imports.py
index abf4b77..112dd79 100644
--- a/parsers/imports.py
+++ b/parsers/imports.py
@@ -56,6 +56,8 @@ def import_survex():
troggle.parsers.survex.LoadSurvexBlocks()
print(" - Survex entrances x/y/z Positions")
with transaction.atomic():
+ troggle.parsers.survex.caveifywallets()
+ with transaction.atomic():
troggle.parsers.locations.LoadPositions()
def import_ents():
diff --git a/parsers/survex.py b/parsers/survex.py
index e1633ce..a86399f 100644
--- a/parsers/survex.py
+++ b/parsers/survex.py
@@ -2481,6 +2481,17 @@ def MakeFileRoot(svxpath):
return fileroot
+def caveifywallets():
+ """Gets the caves from the list of survexblocks
+ """
+ wallets = Wallet.objects.all()
+ for w in wallets:
+ blocks = SurvexBlock.objects.filter(scanswallet=w)
+ for b in blocks:
+ # NB b.cave is not populated by parser. Use b.survexfile.cave instead, or we could parse b.survexpath
+ if b.survexfile.cave:
+ w.caves.add(b.survexfile.cave)
+
def LoadSurvexBlocks():
global dup_includes
@@ -2536,4 +2547,6 @@ def LoadSurvexBlocks():
if dup_includes > 0:
print(f" - ERROR: There are {dup_includes} duplicate *includes in the final list")
print(" - Loaded All Survex Blocks.")
+
+