mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-14 19:47:12 +00:00
prospect and moving code to better places
This commit is contained in:
@@ -12,11 +12,10 @@ from django.utils.timezone import get_current_timezone
|
||||
from django.utils.timezone import make_aware
|
||||
|
||||
import troggle.settings as settings
|
||||
import troggle.core.models.caves as models_caves
|
||||
from troggle.core.models.caves import Entrance, QM
|
||||
from troggle.core.utils import get_process_memory, chaosmonkey
|
||||
from troggle.parsers.people import GetPersonExpeditionNameLookup
|
||||
from troggle.parsers.logbooks import GetCaveLookup
|
||||
from troggle.core.views.prospect import MapLocations
|
||||
from troggle.core.models.troggle import DataIssue, Expedition
|
||||
from troggle.core.models.survex import SurvexPersonRole, ScansFolder, SurvexDirectory, SurvexFile, SurvexBlock, SurvexStation
|
||||
|
||||
@@ -32,6 +31,46 @@ debugprint = False # Turns on debug printout for just one *include file
|
||||
debugprinttrigger = "!"
|
||||
# debugprinttrigger = "caves-1623/40/old/EisSVH"
|
||||
|
||||
class MapLocations(object):
|
||||
p = [
|
||||
("laser.0_7", "BNase", "Reference", "Bräuning Nase laser point"),
|
||||
("226-96", "BZkn", "Reference", "Bräuning Zinken trig point"),
|
||||
("vd1","VD1","Reference", "VD1 survey point"),
|
||||
("laser.kt114_96","HSK","Reference", "Hinterer Schwarzmooskogel trig point"),
|
||||
("2000","Nipple","Reference", "Nipple (Weiße Warze)"),
|
||||
("3000","VSK","Reference", "Vorderer Schwarzmooskogel summit"),
|
||||
("topcamp", "OTC", "Reference", "Old Top Camp"),
|
||||
("laser.0", "LSR0", "Reference", "Laser Point 0"),
|
||||
("laser.0_1", "LSR1", "Reference", "Laser Point 0/1"),
|
||||
("laser.0_3", "LSR3", "Reference", "Laser Point 0/3"),
|
||||
("laser.0_5", "LSR5", "Reference", "Laser Point 0/5"),
|
||||
("225-96", "BAlm", "Reference", "Bräuning Alm trig point")
|
||||
]
|
||||
def points(self):
|
||||
for ent in Entrance.objects.all():
|
||||
if ent.best_station():
|
||||
try:
|
||||
k = ent.caveandentrance_set.all()[0].cave
|
||||
except:
|
||||
message = " ! Failed to get Cave linked to Entrance:{} from:{} best:{}".format(ent.name, ent.filename, ent.best_station())
|
||||
DataIssue.objects.create(parser='entrances', message=message)
|
||||
print(message)
|
||||
raise
|
||||
try:
|
||||
areaName = k.getArea().short_name
|
||||
except:
|
||||
message = " ! Failed to get Area on cave '{}' linked to Entrance:{} from:{} best:{}".format(cave, ent.name, ent.filename, ent.best_station())
|
||||
DataIssue.objects.create(parser='entrances', message=message)
|
||||
print(message)
|
||||
raise
|
||||
self.p.append((ent.best_station(), "%s-%s" % (areaName, str(ent)[5:]), ent.needs_surface_work(), str(ent)))
|
||||
message = f" - {len(self.p)} entrances linked to caves."
|
||||
print(message)
|
||||
return self.p
|
||||
|
||||
def __str__(self):
|
||||
return "{} map locations".format(len(self.p))
|
||||
|
||||
class SurvexLeg():
|
||||
"""No longer a models.Model subclass, so no longer a database table
|
||||
"""
|
||||
@@ -468,7 +507,7 @@ class LoadingSurvex():
|
||||
# NB none of the SurveyStations are in the DB now, so if we want to link to aSurvexStation
|
||||
# we would have to create one. But that is not obligatory and no QMs loaded from CSVs have one
|
||||
try:
|
||||
qm = models_caves.QM.objects.create(number=qm_no,
|
||||
qm = QM.objects.create(number=qm_no,
|
||||
# nearest_station=a_survex_station_object, # can be null
|
||||
nearest_station_description=qm_resolve_station,
|
||||
nearest_station_name=qm_nearest,
|
||||
@@ -747,7 +786,7 @@ class LoadingSurvex():
|
||||
path_match = re.search(r"caves-(\d\d\d\d)/(\d+|\d\d\d\d-?\w+-\d+)/", survexblock.survexfile.path)
|
||||
if path_match:
|
||||
pos_cave = '%s-%s' % (path_match.group(1), path_match.group(2))
|
||||
cave = models_caves.getCaveByReference(pos_cave)
|
||||
cave = getCaveByReference(pos_cave)
|
||||
if cave:
|
||||
survexfile.cave = cave
|
||||
|
||||
@@ -1369,5 +1408,5 @@ def LoadPositions():
|
||||
print(message)
|
||||
DataIssue.objects.create(parser='survex', message=message)
|
||||
raise
|
||||
print(" - {} SurvexStation entrances found.".format(found))
|
||||
print(" - {} SurvexStation entrances found.".format(found))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user