forked from expo/troggle
find perps guilty of bad *ref brhaviour
This commit is contained in:
@@ -96,6 +96,13 @@ class SurvexLeg():
|
|||||||
compass = 0.0
|
compass = 0.0
|
||||||
clino = 0.0
|
clino = 0.0
|
||||||
|
|
||||||
|
def get_people_on_trip(survexblock):
|
||||||
|
qpeople = SurvexPersonRole.objects.filter(survexblock=survexblock)
|
||||||
|
people = []
|
||||||
|
for p in qpeople:
|
||||||
|
people.append(f'{p.personname}')
|
||||||
|
return list(set(people))
|
||||||
|
|
||||||
class LoadingSurvex():
|
class LoadingSurvex():
|
||||||
"""A 'survex block' is a *begin...*end set of cave data.
|
"""A 'survex block' is a *begin...*end set of cave data.
|
||||||
A survex file can contain many begin-end blocks, which can be nested, and which can *include
|
A survex file can contain many begin-end blocks, which can be nested, and which can *include
|
||||||
@@ -140,6 +147,7 @@ class LoadingSurvex():
|
|||||||
rx_argsref = re.compile(r'(?i)^[\s.:]*((?:19[6789]\d)|(?:20[012345]\d))\s*#?\s*(X)?\s*(.*?\d+.*?)$')
|
rx_argsref = re.compile(r'(?i)^[\s.:]*((?:19[6789]\d)|(?:20[012345]\d))\s*#?\s*(X)?\s*(.*?\d+.*?)$')
|
||||||
rx_badmerge= re.compile(r'(?i).*(\>\>\>\>\>)|(\=\=\=\=\=)|(\<\<\<\<\<).*$')
|
rx_badmerge= re.compile(r'(?i).*(\>\>\>\>\>)|(\=\=\=\=\=)|(\<\<\<\<\<).*$')
|
||||||
rx_ref2 = re.compile(r'(?i)\s*ref[.;]?')
|
rx_ref2 = re.compile(r'(?i)\s*ref[.;]?')
|
||||||
|
rx_commteam = re.compile(r'(?i)\s*(Messteam|Zeichner)\s*[:]?(.*)')
|
||||||
|
|
||||||
|
|
||||||
# This interprets the survex "*data normal" command which sets out the order of the fields in the data, e.g.
|
# This interprets the survex "*data normal" command which sets out the order of the fields in the data, e.g.
|
||||||
@@ -311,14 +319,16 @@ class LoadingSurvex():
|
|||||||
setdate(year)
|
setdate(year)
|
||||||
elif len(line) == 7:
|
elif len(line) == 7:
|
||||||
year = line[:4]
|
year = line[:4]
|
||||||
message = "! DATE Warning only accurate to the month, setting to 1st '{}' ({}) {}".format(oline, survexblock, survexblock.survexfile.path)
|
perps = get_people_on_trip(survexblock) # What, you don't know Judge Dredd slang ?
|
||||||
|
message = f"! DATE Warning only accurate to the month, setting to 1st '{oline}' ({survexblock}) {survexblock.survexfile.path} {perps}"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
survexblock.date = datetime.strptime(line.replace('.','-'), '%Y-%m') # sets to first of month
|
survexblock.date = datetime.strptime(line.replace('.','-'), '%Y-%m') # sets to first of month
|
||||||
setdate(year)
|
setdate(year)
|
||||||
elif len(line) == 4:
|
elif len(line) == 4:
|
||||||
year = line[:4]
|
year = line[:4]
|
||||||
message = "! DATE WARNING only accurate to the YEAR, setting to 1st January '{}' ({}) {}".format(oline, survexblock, survexblock.survexfile.path)
|
perps = get_people_on_trip(survexblock)
|
||||||
|
message = f"! DATE WARNING only accurate to the YEAR, setting to 1st January '{oline}' ({survexblock}) {survexblock.survexfile.path} {perps}"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
survexblock.date = datetime.strptime(line, '%Y') # sets to January 1st
|
survexblock.date = datetime.strptime(line, '%Y') # sets to January 1st
|
||||||
@@ -473,6 +483,7 @@ class LoadingSurvex():
|
|||||||
# delete the object to save memory
|
# delete the object to save memory
|
||||||
survexleg = None
|
survexleg = None
|
||||||
|
|
||||||
|
|
||||||
def LoadSurvexRef(self, survexblock, args):
|
def LoadSurvexRef(self, survexblock, args):
|
||||||
#print(self.insp+ "*REF ---- '"+ args +"'")
|
#print(self.insp+ "*REF ---- '"+ args +"'")
|
||||||
url= get_offending_filename(survexblock.survexfile.path)
|
url= get_offending_filename(survexblock.survexfile.path)
|
||||||
@@ -493,7 +504,8 @@ class LoadingSurvex():
|
|||||||
if argsgps:
|
if argsgps:
|
||||||
yr, letterx, wallet = argsgps.groups()
|
yr, letterx, wallet = argsgps.groups()
|
||||||
else:
|
else:
|
||||||
message = " ! Wallet *REF '{}' malformed id in '{}' ".format(args, survexblock.survexfile.path)
|
perps = get_people_on_trip(survexblock)
|
||||||
|
message = f" ! Wallet *REF '{args}' malformed id in '{survexblock.survexfile.path}' {perps}"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=url)
|
DataIssue.objects.create(parser='survex', message=message, url=url)
|
||||||
return
|
return
|
||||||
@@ -530,7 +542,8 @@ class LoadingSurvex():
|
|||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=url)
|
DataIssue.objects.create(parser='survex', message=message, url=url)
|
||||||
else:
|
else:
|
||||||
message = " ! Wallet *REF '{}' - NOT found '{}' in database".format(refscan, survexblock.survexfile.path)
|
perps = get_people_on_trip(survexblock)
|
||||||
|
message = f" ! Wallet *REF '{refscan}' in '{survexblock.survexfile.path}' {perps} NOT in database i.e. wallet does not exist."
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=url)
|
DataIssue.objects.create(parser='survex', message=message, url=url)
|
||||||
|
|
||||||
@@ -864,6 +877,16 @@ class LoadingSurvex():
|
|||||||
print(f'rx_ref2 -- {comment=} in {survexblock.survexfile.path} :: {survexblock}')
|
print(f'rx_ref2 -- {comment=} in {survexblock.survexfile.path} :: {survexblock}')
|
||||||
self.LoadSurvexRef(survexblock, comment)
|
self.LoadSurvexRef(survexblock, comment)
|
||||||
|
|
||||||
|
# handle
|
||||||
|
# ; Messteam: Jörg Haussmann, Robert Eckardt, Thilo Müller
|
||||||
|
# ; Zeichner: Thilo Müller
|
||||||
|
# But none of these will be valid teammembers because they are not actually on our expo
|
||||||
|
|
||||||
|
team = self.rx_commteam.match(comment)
|
||||||
|
if team:
|
||||||
|
print(f'rx_commteam -- {comment=} in {survexblock.survexfile.path} :: {survexblock}')
|
||||||
|
pass
|
||||||
|
|
||||||
qml = self.rx_qm0.match(comment)
|
qml = self.rx_qm0.match(comment)
|
||||||
if qml:
|
if qml:
|
||||||
qmline = self.rx_qm.match(comment)
|
qmline = self.rx_qm.match(comment)
|
||||||
|
|||||||
Reference in New Issue
Block a user