Fixing inherited *date into sub-blocks

This commit is contained in:
2023-03-14 02:12:28 +00:00
parent b428a87f1a
commit 85fab88ac9
5 changed files with 55 additions and 22 deletions

View File

@@ -162,8 +162,9 @@ class QM(TroggleModel):
("B", "B: Average lead"),
("C", "C: Tight unpromising lead"),
("D", "D: Dig"),
("X", "X: Unclimbable aven"),
) # also seen "?" and "V" in imported data - see urls.py
("X", "X: Unclimbable or horrid"),
("V", "V: Vertical"),
) # also seen "?" in imported data - see urls.py
grade = models.CharField(max_length=1, choices=GRADE_CHOICES)
location_description = models.TextField(blank=True)
nearest_station_description = models.CharField(max_length=400, blank=True, null=True)

View File

@@ -344,6 +344,7 @@ def svx(request, survex_file):
# collect all the survex blocks which actually have a valid date
if svxfile:
has_3d = (Path(survexdatasetpath) / Path(survex_file + ".3d")).is_file()
try:
svxblocks = svxfile.survexblock_set.filter(date__isnull=False).order_by('date')
except:
@@ -353,12 +354,14 @@ def svx(request, survex_file):
svxlength = 0.0
for b in svxblocksall:
svxlength += b.legslength
print(svxlength,b, b.legsall)
# print(svxlength,b, b.legsall)
except AttributeError: # some survexfiles just *include files and have no blocks themselves
svxblocksall = []
else:
svxblocks = []
svxblocksall = []
svxlength = 0.0
has_3d = False
if not difflist:
difflist = ["Survex file does not exist yet"]
@@ -368,7 +371,7 @@ def svx(request, survex_file):
vmap = {
"settings": settings,
"warning": warning,
"has_3d": (Path(survexdatasetpath) / Path(survex_file + ".3d")).is_file(),
"has_3d": has_3d,
"title": survex_file,
"svxlength": svxlength,
"svxblocks": svxblocks,