mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-01-31 15:32:35 +00:00
Better error msgs, one bug fix
This commit is contained in:
parent
04f14c91f0
commit
d3654266ee
@ -118,8 +118,8 @@ class LoadSurvex():
|
||||
if stardata["type"] == "normal": # should use current flags setting for this
|
||||
# print(" !! lineno '{}'\n !! svxline '{}'\n !! sline '{}'\n !! ls '{}'\n !! stardata {}".format(self.lineno, svxline, sline, ls,stardata))
|
||||
tape = ls[stardata["tape"]]
|
||||
tape = tape.replace("(",".")
|
||||
tape = tape.replace(")",".")
|
||||
tape = tape.replace("(","")
|
||||
tape = tape.replace(")","")
|
||||
tape = tape.replace("/",".")
|
||||
try:
|
||||
survexleg.tape = float(tape)
|
||||
@ -186,7 +186,7 @@ class LoadSurvex():
|
||||
def LoadSurvexRef(self, survexblock, args):
|
||||
# *REF but also ; Ref years from 1960 to 2039
|
||||
if len(args)< 4:
|
||||
message = " ! Empty or BAD *REF command '{}' at {}".format(args, survexblock.survexfile.path)
|
||||
message = " ! Empty or BAD *REF command '{}' in '{}'".format(args, survexblock.survexfile.path)
|
||||
print((self.insp+message))
|
||||
models.DataIssue.objects.create(parser='survex', message=message)
|
||||
return
|
||||
@ -195,7 +195,7 @@ class LoadSurvex():
|
||||
if argsgps:
|
||||
yr, letterx, wallet = argsgps.groups()
|
||||
else:
|
||||
message = " ! BAD *REF command '{}' at {}".format(args, survexblock.survexfile.path)
|
||||
message = " ! BAD *REF command '{}' in '{}'".format(args, survexblock.survexfile.path)
|
||||
print((self.insp+message))
|
||||
models.DataIssue.objects.create(parser='survex', message=message)
|
||||
return
|
||||
@ -210,11 +210,11 @@ class LoadSurvex():
|
||||
refscan = "%s#%s%s" % (yr, letterx, wallet)
|
||||
try:
|
||||
if int(wallet)>100:
|
||||
message = " ! Wallet *REF {} - too big {}".format(refscan, survexblock.survexfile.path)
|
||||
message = " ! Wallet *REF {} - too big in '{}'".format(refscan, survexblock.survexfile.path)
|
||||
print((self.insp+message))
|
||||
models.DataIssue.objects.create(parser='survex', message=message)
|
||||
except:
|
||||
message = " ! Wallet *REF {} - not numeric {}".format(refscan, survexblock.survexfile.path)
|
||||
message = " ! Wallet *REF {} - not numeric in '{}'".format(refscan, survexblock.survexfile.path)
|
||||
print((self.insp+message))
|
||||
models.DataIssue.objects.create(parser='survex', message=message)
|
||||
manyscansfolders = models_survex.ScansFolder.objects.filter(walletname=refscan)
|
||||
@ -222,11 +222,11 @@ class LoadSurvex():
|
||||
survexblock.scansfolder = manyscansfolders[0]
|
||||
survexblock.save()
|
||||
if len(manyscansfolders) > 1:
|
||||
message = " ! Wallet *REF {} - multiple scan folders found {}".format(refscan, survexblock.survexfile.path)
|
||||
message = " ! Wallet *REF {} - {} scan folders from DB search in {}".format(refscan, len(manyscansfolders), survexblock.survexfile.path)
|
||||
print((self.insp+message))
|
||||
models.DataIssue.objects.create(parser='survex', message=message)
|
||||
else:
|
||||
message = " ! Wallet *REF {} - NOT found in manyscansfolders {}".format(refscan, survexblock.survexfile.path)
|
||||
message = " ! Wallet *REF '{}' - NOT found in DB search '{}'".format(refscan, survexblock.survexfile.path)
|
||||
print((self.insp+message))
|
||||
models.DataIssue.objects.create(parser='survex', message=message)
|
||||
|
||||
@ -235,7 +235,7 @@ class LoadSurvex():
|
||||
insp = self.insp
|
||||
qm_no = qmline.group(1)
|
||||
qm_grade = qmline.group(2)
|
||||
qm_from_section = qmline.group(3)
|
||||
qm_from_block = qmline.group(3) # usual closest survey station
|
||||
qm_from_station = qmline.group(4)
|
||||
qm_resolve_section = qmline.group(6)
|
||||
qm_resolve_station = qmline.group(7)
|
||||
@ -250,30 +250,44 @@ class LoadSurvex():
|
||||
# print(insp+'Cave - %s' % survexfile.cave)
|
||||
# print(insp+'QM no %d' % int(qm_no))
|
||||
# print(insp+'QM grade %s' % qm_grade)
|
||||
# print(insp+'QM section %s' % qm_from_section)
|
||||
# print(insp+'QM section %s' % qm_from_block)
|
||||
# print(insp+'QM station %s' % qm_from_station)
|
||||
# print(insp+'QM res section %s' % qm_resolve_section)
|
||||
# print(insp+'QM res station %s' % qm_resolve_station)
|
||||
# print(insp+'QM notes %s' % qm_notes)
|
||||
|
||||
# If the QM isn't resolved (has a resolving station) then load it
|
||||
# If the QM isn't resolved (has a resolving station) then load it.
|
||||
# NB none of the SurveyStations are in the DB now, so searching always fails
|
||||
if not qm_resolve_section or qm_resolve_section != '-' or qm_resolve_section != 'None':
|
||||
from_section = models_survex.SurvexBlock.objects.filter(name=qm_from_section)
|
||||
from_block = models_survex.SurvexBlock.objects.filter(name=qm_from_block)
|
||||
# If we can find a section (survex note chunk, named)
|
||||
if len(from_section) > 0:
|
||||
from_station = models_survex.SurvexStation.objects.filter(block=from_section[0], name=qm_from_station)
|
||||
if len(from_block) > 0:
|
||||
from_station = models_survex.SurvexStation.objects.filter(block=from_block[0], name=qm_from_station)
|
||||
# If we can find a from station then we have the nearest station and can import it
|
||||
# but now that we don't import all the stations this will fail
|
||||
if len(from_station) > 0:
|
||||
qm = models_caves.QM.objects.create(number=qm_no,
|
||||
nearest_station=from_station[0],
|
||||
grade=qm_grade.upper(),
|
||||
location_description=qm_notes)
|
||||
else:
|
||||
message = ' ! QM {} in {} NOT resolved and NOT found'.format(qm_no, survexblock.survexfile.path)
|
||||
message = " - QM{} in '{}' loaded into DB using '{}'".format(qm_no, survexblock.survexfile.path,str(from_station[0]))
|
||||
print(insp+message)
|
||||
models.DataIssue.objects.create(parser='survex', message=message)
|
||||
else:
|
||||
try:
|
||||
qm = models_caves.QM.objects.create(number=qm_no,
|
||||
nearest_station=qm_from_block,
|
||||
grade=qm_grade.upper(),
|
||||
location_description=qm_notes)
|
||||
message = " ! QM{} in '{}' CREATED in DB at '{}'".format(qm_no, survexblock.survexfile.path, qm_from_block)
|
||||
print(insp+message)
|
||||
models.DataIssue.objects.create(parser='survex', message=message)
|
||||
except:
|
||||
message = " ! QM{} in '{}' failed to create in DB at '{}'".format(qm_no, survexblock.survexfile.path, qm_from_block)
|
||||
print(insp+message)
|
||||
models.DataIssue.objects.create(parser='survex', message=message)
|
||||
else:
|
||||
message = ' ! QM {} in {} found and resolved as {}'.format(qm_no, survexblock.survexfile.path,qm_resolve_section)
|
||||
message = " - QM{} in '{}' resolved as '{}'".format(qm_no, survexblock.survexfile.path,qm_resolve_section)
|
||||
print(insp+message)
|
||||
models.DataIssue.objects.create(parser='survex', message=message)
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user