diagnosing missing entrance file

This commit is contained in:
Philip Sargent 2022-12-22 00:56:46 +00:00
parent a7a126dd55
commit f23764c486
4 changed files with 15 additions and 7 deletions

View File

@ -46,7 +46,7 @@ from django.db import transaction
from troggle.core.utils import get_process_memory from troggle.core.utils import get_process_memory
from troggle.core.models.caves import Cave, Entrance 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 import_logbooks, import_logbook, import_QMs, import_survex, import_loadpos, import_drawingsfiles
if os.geteuid() == 0: if os.geteuid() == 0:
@ -343,6 +343,7 @@ def usage():
scans - the survey scans in all the wallets (must run before survex) 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 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 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 ) dumplogbooks - Not used. write out autologbooks (not working? use http://localhost:8000/controlpanel )
logbook - read a single logbook. Defautl set in python code logbook - read a single logbook. Defautl set in python code
@ -385,9 +386,8 @@ if __name__ == "__main__":
exit() exit()
elif "init" in sys.argv: elif "init" in sys.argv:
jq.enq("reinit",reinit_db) jq.enq("reinit",reinit_db)
elif "test" in sys.argv: elif "ents" in sys.argv:
jq.enq("caves",import_caves) jq.enq("survex",import_ents)
jq.enq("people",import_people)
elif "test2" in sys.argv: elif "test2" in sys.argv:
jq.enq("QMs",import_QMs) jq.enq("QMs",import_QMs)
jq.enq("drawings",import_drawingsfiles) jq.enq("drawings",import_drawingsfiles)

View File

@ -63,6 +63,13 @@ def import_survex():
with transaction.atomic(): with transaction.atomic():
troggle.parsers.survex.LoadPositions() 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(): def import_loadpos():
# when this import is moved to the top with the rest it all crashes horribly # when this import is moved to the top with the rest it all crashes horribly
import troggle.parsers.survex import troggle.parsers.survex

View File

@ -69,13 +69,14 @@ class MapLocations(object):
def points(self): def points(self):
for ent in Entrance.objects.all(): for ent in Entrance.objects.all():
if ent.best_station(): if ent.best_station():
print(f"{ent.filename}", end=", ")
try: try:
k = ent.caveandentrance_set.all()[0].cave k = ent.caveandentrance_set.all()[0].cave
except: 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) DataIssue.objects.create(parser='entrances', message=message)
print(message) print(message)
raise continue # skip this entrance
try: try:
areaName = k.getArea().short_name areaName = k.getArea().short_name
except: except:

View File

@ -23,7 +23,7 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c
{% include 'wallet_table.html' %} {% include 'wallet_table.html' %}
<br /> <br />
<table width=95%> <table width=95%>
<tr><th>Wallet</th><th width=13%>Wallet Date</th><th>Wallet Name</th><th width=25%>>People</th><th>Scans</th><th>Survex blocks</th><th>Drawings using these scans</th></tr> <tr><th>Wallet</th><th width=13%>Wallet Date</th><th>Wallet Name</th><th width=25%>People</th><th>Scans</th><th>Survex blocks</th><th>Drawings using these scans</th></tr>
{% for wallet in manywallets|dictsort:"walletname" %} {% for wallet in manywallets|dictsort:"walletname" %}
<tr> <tr>
<td style="padding:2px"><a href="{{wallet.get_absolute_url}}">{{wallet.walletname}}</a></td> <td style="padding:2px"><a href="{{wallet.get_absolute_url}}">{{wallet.walletname}}</a></td>