2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

units conversion not quite working

This commit is contained in:
Philip Sargent 2020-07-07 02:46:18 +01:00
parent efc43b0863
commit 52afb9f466

View File

@ -23,7 +23,8 @@ survexblockroot = None
ROOTBLOCK = "rootblock"
debugprint = False # Turns on debug printout for just one *include file
debugprinttrigger = "caves-1623/40/old/EisSVH"
debugprinttrigger = "!"
# debugprinttrigger = "caves-1623/40/old/EisSVH"
class SurvexLeg():
"""No longer a models.Model subclass, so no longer a database table
@ -58,7 +59,7 @@ class LoadingSurvex():
rx_person = re.compile(r"(?i) and | / |, | & | \+ |^both$|^none$")
rx_qm = re.compile(r'(?i)^\s*QM(\d)\s+?([a-dA-DxX])\s+([\w\-]+)\.(\d+)\s+(([\w\-]+)\.(\d+)|\-)\s+(.+)$')
# remember there is also QM_PATTERN used in views_other and set in settings.py
rx_tapelng = re.compile(r'(?i)(tape|length)$')
rx_tapelng = re.compile(r'(?i).*(tape|length).*$')
rx_cave = re.compile(r'(?i)caves-(\d\d\d\d)/([-\d\w]+|\d\d\d\d-?\w+-\d+)')
rx_comment = re.compile(r'([^;]*?)\s*(?:;\s*(.*))?\n?$')
@ -168,6 +169,16 @@ class LoadingSurvex():
tapeunits = self.rx_tapelng.match(line) # tape|length
if not tapeunits:
return
message = "! *UNITS '{}' ({}) {}".format(line, survexblock, survexblock.survexfile.path)
print((self.insp+message))
models.DataIssue.objects.create(parser='survex', message=message)
convert = re.match("(?i).*([\.\d]+).*",line)
if convert:
factor = convert.groups()[0]
message = "! *UNITS numerical conversion - not converted <{}x> '{}' ({}) {}".format(factor, line, survexblock, survexblock.survexfile.path)
print((self.insp+message))
models.DataIssue.objects.create(parser='survex', message=message)
feet = re.match("(?i)feet$",line)
metres = re.match("(?i)(METRIC|METRES|METERS)",line)
if feet: