2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-02-08 11:28:23 +00:00

Adding SUrvexFix class

This commit is contained in:
2025-07-29 19:42:59 +02:00
parent 959c358c09
commit 7a9bcd02f7
3 changed files with 28 additions and 16 deletions

View File

@@ -60,7 +60,7 @@ class MapLocations(object):
# but not in troggle reports unless we include them here
nullent = Entrance.objects.all()[0]
# These pending entrnces have been added to the fixedpts but no Cave Description page has been created yet,
# These pending entrances have been added to the fixedpts but no Cave Description page has been created yet,
# nor are they on the pendingcaves.txt list - yet - as they really need a proper name,
# /walletedit/2013:02
# so probably 2013-BL-02,03 etc.
@@ -393,5 +393,7 @@ def LoadPositions():
print(f" - {found} distinct SurvexStation entrance stations identified in {lineno:,} lines in {positions_filename}.")
if dups > 0:
print(f" - {dups} Duplicated SurvexStation entrances found")
store_data_issues()

View File

@@ -10,7 +10,7 @@ from pathlib import Path
import troggle.settings as settings
from troggle.core.models.caves import Cave, Entrance, GetCaveLookup
from troggle.core.models.logbooks import QM
from troggle.core.models.survex import SurvexBlock, SurvexFile, SurvexPersonRole, SurvexStation
from troggle.core.models.survex import SurvexBlock, SurvexFile, SurvexPersonRole, SurvexStation, SurvexFix
from troggle.core.models.troggle import DataIssue, Expedition
from troggle.core.models.wallets import Wallet
from troggle.core.utils import chaosmonkey, get_process_memory
@@ -2544,30 +2544,24 @@ def FindAndLoadSurvex():
print(f" - Number of SurvexFiles: {tf:,}")
print(f" - Number of Survex *fix: {fixnumber:,}")
print(f" - Number of Survex legs: {legsnumber:,}")
for f in svx_load.fixes:
fixlist = []
for f in svx_load.fixes:
survexblock, name, altitude, comment = svx_load.fixes[f]
fixlist.append(SurvexFix(name=name))
# this loses the survex context, e.g. 1623. or 1626. is lost
# we would need to track teh *begin/*end labels to do that
s = survexblock
spath = s.parent.survexfile
# sprevious = None
# while s.parent != sprevious:
# spath += str(s.parent) + ":" + spath
# sprevious = s
# if not s.parent:
# break
# s = s.parent
ff = survexblock.survexfile
# print(f"FIX {name} : {ff} {survexblock} ; {comment}")
if comment:
# print(f"FIX {survexblock} {altitude} {comment}")
if re.match(r"(?i)[^s]*srtm[\s\S]*", comment.lower()):
print(f"SRTM {ff}.svx::{survexblock} - {spath}.svx - alt={altitude} '{comment}'")
if re.match(r"(?i)[^s]*radost[\s\S]*", comment.lower()):
print(f"RDST {ff}.svx::{survexblock} - {spath}.svx - alt={altitude} '{comment}'")
SurvexFix.objects.bulk_create(fixlist)
svx_load = None
return legsnumber
def display_contents(blocks):