mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 08:41:51 +00:00
bugfixes
This commit is contained in:
parent
4e9680a3ad
commit
55bc042798
@ -234,35 +234,37 @@ class LoadingSurvex():
|
||||
# we will have to attach them to the survexblock anyway, and then do a
|
||||
# later check on whether they are valid when we get the date.
|
||||
|
||||
personrole, created = SurvexPersonRole.objects.update_or_create(survexblock=survexblock, personexpedition=personexpedition, personname=tm)
|
||||
|
||||
expo = survexblock.expedition # may be None if no *date yet
|
||||
# this syntax was bizarre.. made more obvious
|
||||
if expo:
|
||||
if survexblock.expeditionday: # *date has been set
|
||||
personrole.expeditionday = survexblock.expeditionday
|
||||
else:
|
||||
if not survexblock.expeditionday: # *date has been set
|
||||
# should not happen
|
||||
message = "! *team {} expo ok, expedition day not in *team {} ({}) created? '{}'".format(expo.year, survexblock.survexfile.path, survexblock, created )
|
||||
message = "! *team {} expo ok, expedition day not in *team {} ({}) ".format(expo.year, survexblock.survexfile.path, survexblock )
|
||||
print(self.insp+message)
|
||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||
|
||||
|
||||
personexpedition = GetPersonExpeditionNameLookup(expo).get(tm.lower())
|
||||
if personexpedition:
|
||||
personrole, created = SurvexPersonRole.objects.update_or_create(survexblock=survexblock, personexpedition=personexpedition, personname=tm)
|
||||
personrole.person=personexpedition.person
|
||||
self.currentpersonexped.append(personexpedition)
|
||||
|
||||
if not personexpedition:
|
||||
personrole.expeditionday = survexblock.expeditionday
|
||||
self.currentpersonexped.append(personexpedition) # used in push/pop block code
|
||||
personrole.save()
|
||||
else:
|
||||
# we know the date and expo, but can't find the person
|
||||
message = "! *team {} '{}' FAIL personexpedition lookup on *team {} ({}) in '{}' {} ".format(expo.year, tm, survexblock.survexfile.path, survexblock, created, line)
|
||||
message = "! *team {} '{}' FAIL personexpedition lookup on *team {} ({}) in '{}'".format(expo.year, tm, survexblock.survexfile.path, survexblock, line)
|
||||
print(self.insp+message)
|
||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||
else:
|
||||
personexpedition = None
|
||||
# don't know the date yet, assume the person is valid. It wull get picked up with the *date appears
|
||||
|
||||
personrole, created = SurvexPersonRole.objects.update_or_create(survexblock=survexblock, personexpedition=personexpedition, personname=tm)
|
||||
# don't know the date yet, so cannot query the table about validity.
|
||||
# assume the person is valid. It will get picked up with the *date appears
|
||||
personrole.save()
|
||||
|
||||
|
||||
|
||||
mteammember = self.rx_teammem.match(line) # matches the role at the beginning
|
||||
if not mteammember:
|
||||
moldstyle = self.rx_teamold.match(line) # matches the role at the the end of the string
|
||||
@ -352,34 +354,34 @@ class LoadingSurvex():
|
||||
# we should make this a date RANGE for everything?
|
||||
|
||||
def setdate_on_survexblock(year):
|
||||
# We are assuming that deferred *team people are in the same block. Otherwise, ouch.
|
||||
expo = self.get_expo_from_year(year)
|
||||
survexblock.expedition = expo
|
||||
survexblock.expeditionday = expo.get_expedition_day(survexblock.date)
|
||||
survexblock.save()
|
||||
|
||||
team = SurvexPersonRole.objects.filter(survexblock=survexblock)
|
||||
for p in team:
|
||||
if not p.expeditionday: # *date and *team in 'wrong' order. All working now.
|
||||
for pr in team:
|
||||
if not pr.expeditionday: # *date and *team in 'wrong' order. All working now.
|
||||
|
||||
p.expeditionday = survexblock.expeditionday
|
||||
p.save()
|
||||
pr.expeditionday = survexblock.expeditionday
|
||||
pr.save()
|
||||
|
||||
if not p.personexpedition: # again, we didn't know the date until now
|
||||
pe = GetPersonExpeditionNameLookup(expo).get(p.personname.lower())
|
||||
if not pr.personexpedition: # again, we didn't know the date until now
|
||||
pe = GetPersonExpeditionNameLookup(expo).get(pr.personname.lower())
|
||||
if pe:
|
||||
# message = "! {} ({}) Fixing undated personexpedition '{}'".format(survexblock.survexfile.path, survexblock, p.personname)
|
||||
# print(self.insp+message)
|
||||
# DataIssue.objects.create(parser='survex', message=message)
|
||||
p.personexpedition = pe
|
||||
p.person = p.personexpedition.person
|
||||
p.save()
|
||||
pr.personexpedition = pe
|
||||
pr.person = p.personexpedition.person
|
||||
pr.save()
|
||||
self.currentpersonexped.append(pe) # used in push/pop block code
|
||||
else:
|
||||
message = "! *team {} '{}' FAIL personexpedition lookup on *date {} ({}) '{}'".format(year, p, survexblock.survexfile.path, survexblock, p.personname)
|
||||
print(self.insp+message)
|
||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||
|
||||
|
||||
|
||||
oline = line
|
||||
if len(line) > 10:
|
||||
# message = "! DATE Warning LONG DATE '{}' ({}) {}".format(oline, survexblock, survexblock.survexfile.path)
|
||||
|
Loading…
Reference in New Issue
Block a user