forked from expo/troggle
handling survex files not linked in completely
This commit is contained in:
@@ -142,7 +142,7 @@ def get_complaints(complaints, waldata, svxfiles, files, wallet, wurl):
|
||||
complaints.append("A date is mandatory. No data can be updated or edited unless you specify a date. Look in the survex file if there is one.")
|
||||
|
||||
# People
|
||||
if waldata["people"]==["NOBODY"] or waldata["people"]==["Unknown"]:
|
||||
if not waldata["people"] or waldata["people"]==["NOBODY"] or waldata["people"]==["Unknown"] or waldata["people"]==[""]:
|
||||
complaints.append("Someody must have done this. Look in the survex file, or in the logbook entries for this date, for the people who created this data.")
|
||||
|
||||
# survex, but get_ticks has already done much of this ??
|
||||
@@ -158,11 +158,20 @@ def get_complaints(complaints, waldata, svxfiles, files, wallet, wurl):
|
||||
sx = sx + ".svx"
|
||||
svxfiles.append(sx)
|
||||
if not (Path(settings.SURVEX_DATA) / sx).is_file():
|
||||
file_complaint = f"{wallet} Incorrect survex file name in {wallet} wallet data. {sx} was not found in LOSER repo"
|
||||
file_complaint = f"{wallet} Incorrect survex file name. {sx} was not found in LOSER repo"
|
||||
complaints.append(file_complaint)
|
||||
message = f"! {file_complaint}"
|
||||
print(message)
|
||||
DataIssue.objects.update_or_create(parser='scans', message=message, url=wurl) # set URL to this wallet folder
|
||||
else:
|
||||
try:
|
||||
svxfile = SurvexFile.objects.get(path=sx)
|
||||
except:
|
||||
file_complaint = f"{wallet} Survex file name {sx} was not imported via a *include statement."
|
||||
complaints.append(file_complaint)
|
||||
message = f"! {file_complaint}"
|
||||
print(message)
|
||||
DataIssue.objects.update_or_create(parser='scans', message=message, url=wurl) # set URL to this wallet folder
|
||||
|
||||
if waldata["survex not required"] and waldata["survex file"] != "":
|
||||
survex_complaint = "Survex is stated as not required and yet there is a survex file!"
|
||||
@@ -208,7 +217,7 @@ def get_complaints(complaints, waldata, svxfiles, files, wallet, wurl):
|
||||
if type(caveid) is list:
|
||||
for i in caveid:
|
||||
i = i.replace("/","-")
|
||||
caveobject = getCave(i) # only th elast one gets recorded.. ouch.
|
||||
caveobject = getCave(i) # only the last one gets recorded.. ouch.
|
||||
else:
|
||||
caveid = caveid
|
||||
caveobject = getCave(caveid)
|
||||
@@ -537,34 +546,36 @@ def scanupload(request, path=None):
|
||||
#print(f' - {path=}')
|
||||
try:
|
||||
svxfile = SurvexFile.objects.get(path=path)
|
||||
except:
|
||||
message = f'Specified survex file not found - database apparently empty, you probably need to do a full re-import of all data.'
|
||||
return render(request, 'errors/generic.html', {'message': message})
|
||||
|
||||
print(f' - {svxfile=}')
|
||||
if svxfile.cave:
|
||||
caves.append(svxfile.cave)
|
||||
caverefs.append(svxfile.cave.reference())
|
||||
blocks = SurvexBlock.objects.filter(survexfile= svxfile)
|
||||
for b in blocks:
|
||||
print(f' - - {b=} {b.scanswallet=} {b.date=}')
|
||||
if b.scanswallet:
|
||||
refs.append(b.scanswallet)
|
||||
if b.scanswallet.walletname == wallet:
|
||||
if b.date:
|
||||
dates.append(b.date)
|
||||
if b.name != b.title:
|
||||
names.append(str(b.name) + "|" + str(b.title))
|
||||
else:
|
||||
names.append(str(b.name))
|
||||
# we can use the people, across all blocks that have this *ref
|
||||
QSpeople = SurvexPersonRole.objects.filter(survexblock=b)
|
||||
print(f' - - {QSpeople=}')
|
||||
for p in QSpeople:
|
||||
print(f' - - {p.personname} ')
|
||||
team.append(p.personname)
|
||||
# else:
|
||||
# print(f' - Wallet not matching *ref {b.scanswallet=} {wallet}')
|
||||
print(f' - {svxfile=}')
|
||||
if svxfile.cave:
|
||||
caves.append(svxfile.cave)
|
||||
caverefs.append(svxfile.cave.reference())
|
||||
blocks = SurvexBlock.objects.filter(survexfile= svxfile)
|
||||
for b in blocks:
|
||||
print(f' - - {b=} {b.scanswallet=} {b.date=}')
|
||||
if b.scanswallet:
|
||||
refs.append(b.scanswallet)
|
||||
if b.scanswallet.walletname == wallet:
|
||||
if b.date:
|
||||
dates.append(b.date)
|
||||
if b.name != b.title:
|
||||
names.append(str(b.name) + "|" + str(b.title))
|
||||
else:
|
||||
names.append(str(b.name))
|
||||
# we can use the people, across all blocks that have this *ref
|
||||
QSpeople = SurvexPersonRole.objects.filter(survexblock=b)
|
||||
print(f' - - {QSpeople=}')
|
||||
for p in QSpeople:
|
||||
print(f' - - {p.personname} ')
|
||||
team.append(p.personname)
|
||||
# else:
|
||||
# print(f' - Wallet not matching *ref {b.scanswallet=} {wallet}')
|
||||
except:
|
||||
message = f'Specified survex file not found - database may be empty, or this survex file is not *included anywhere.'
|
||||
# return render(request, 'errors/generic.html', {'message': message})
|
||||
pass
|
||||
|
||||
if dates:
|
||||
waldata["date"] = min(dates).isoformat()
|
||||
print(f' - - {team=} ')
|
||||
|
||||
Reference in New Issue
Block a user