From f23764c4861600adc256ccd48bd45e4c710e761c Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Thu, 22 Dec 2022 00:56:46 +0000 Subject: [PATCH] diagnosing missing entrance file --- databaseReset.py | 8 ++++---- parsers/imports.py | 7 +++++++ parsers/survex.py | 5 +++-- templates/cavewallets.html | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/databaseReset.py b/databaseReset.py index 2d0af58..0c44390 100644 --- a/databaseReset.py +++ b/databaseReset.py @@ -46,7 +46,7 @@ from django.db import transaction from troggle.core.utils import get_process_memory from troggle.core.models.caves import Cave, Entrance -from troggle.parsers.imports import import_caves, import_people, import_surveyscans, \ +from troggle.parsers.imports import import_caves, import_people, import_surveyscans, import_ents, \ import_logbooks, import_logbook, import_QMs, import_survex, import_loadpos, import_drawingsfiles if os.geteuid() == 0: @@ -343,6 +343,7 @@ def usage(): scans - the survey scans in all the wallets (must run before survex) drawings - read in the Tunnel & Therion files - which scans the survey scans too survex - read in the survex files - all the survex blocks and entrances x/y/z + ents - read just the entrances x/y/z (must run after survex) dumplogbooks - Not used. write out autologbooks (not working? use http://localhost:8000/controlpanel ) logbook - read a single logbook. Defautl set in python code @@ -385,9 +386,8 @@ if __name__ == "__main__": exit() elif "init" in sys.argv: jq.enq("reinit",reinit_db) - elif "test" in sys.argv: - jq.enq("caves",import_caves) - jq.enq("people",import_people) + elif "ents" in sys.argv: + jq.enq("survex",import_ents) elif "test2" in sys.argv: jq.enq("QMs",import_QMs) jq.enq("drawings",import_drawingsfiles) diff --git a/parsers/imports.py b/parsers/imports.py index ac671dc..62e7e84 100644 --- a/parsers/imports.py +++ b/parsers/imports.py @@ -63,6 +63,13 @@ def import_survex(): with transaction.atomic(): troggle.parsers.survex.LoadPositions() +def import_ents(): + # when this import is moved to the top with the rest it all crashes horribly + print(" - Survex entrances x/y/z Positions") + with transaction.atomic(): + import troggle.parsers.survex + troggle.parsers.survex.LoadPositions() + def import_loadpos(): # when this import is moved to the top with the rest it all crashes horribly import troggle.parsers.survex diff --git a/parsers/survex.py b/parsers/survex.py index 1f96d6b..27053cd 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -69,13 +69,14 @@ class MapLocations(object): def points(self): for ent in Entrance.objects.all(): if ent.best_station(): + print(f"{ent.filename}", end=", ") try: k = ent.caveandentrance_set.all()[0].cave except: - message = f" ! Failed to get Cave linked to Entrance:{ent.name} from:{ent.filename} best:{ent.best_station()}" + message = f" ! Failed to get Cave linked to Entrance:{ent.name} from:{ent.filename} best:{ent.best_station()} {ent.caveandentrance_set.all()}" DataIssue.objects.create(parser='entrances', message=message) print(message) - raise + continue # skip this entrance try: areaName = k.getArea().short_name except: diff --git a/templates/cavewallets.html b/templates/cavewallets.html index 4f0c5af..6a2fd7c 100644 --- a/templates/cavewallets.html +++ b/templates/cavewallets.html @@ -23,7 +23,7 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c {% include 'wallet_table.html' %}
- + {% for wallet in manywallets|dictsort:"walletname" %}
WalletWallet DateWallet Name>PeopleScansSurvex blocksDrawings using these scans
WalletWallet DateWallet NamePeopleScansSurvex blocksDrawings using these scans
{{wallet.walletname}}