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

trying to debug crashing db

This commit is contained in:
Philip Sargent 2024-02-05 21:18:40 +00:00
parent 1e00e56522
commit c72efe1326

View File

@ -717,10 +717,12 @@ def GetCaveLookup():
Gcave_count.pop(d) # so should not get a duplicate msg below..
ldup.append(d)
if ldup:
message = f" - Ambiguous aliases removed: {ldup}"
message = f" - Ambiguous aliases being removed: {ldup}"
print(message)
update_dataissue("aliases ok", message)
DataIssue.objects.update_or_create(parser="aliases ok", message=message)
for c in Gcave_count:
if Gcave_count[c] > 1:
message = f" ** Duplicate cave id count={Gcave_count[c]} id:'{Gcavelookup[c]}' cave __str__:'{c}'"
@ -728,3 +730,19 @@ def GetCaveLookup():
DataIssue.objects.update_or_create(parser="aliases", message=message)
return Gcavelookup
def update_dataissue(parsercode, message):
try:
DataIssue.objects.update_or_create(parser=parsercode, message=message)
except:
# Complete bollocks, but MariaDB barfs when it shouldn't : Django 3.2
issues = DataIssue.objects.filter(parser=parsercode, message=message)
print(f" # EXCEPTION looking for DataIssue '{parsercode}' {message})")
if len(issues) > 1:
print(f" # MULTIPLE DataIssues '{parsercode}' {message}")
for s in issues:
print(f" # {s.id=} DataIssues '{parsercode}' {message}") # .id is Django internal field, not one of ours
message = "#2 " + message
issue[0].message = message
issue[0].save()