alias as separate error type

This commit is contained in:
Philip Sargent 2022-07-25 04:17:06 +03:00
parent 7785843597
commit f9a7ba7927

View File

@ -591,7 +591,7 @@ def GetCaveLookup():
message = f" - Warning: same alias id '{id:3}' for two caves '{Gcavelookup[id]}' and '{cave}'. Removing this shorthand alias entirely." message = f" - Warning: same alias id '{id:3}' for two caves '{Gcavelookup[id]}' and '{cave}'. Removing this shorthand alias entirely."
Gcavelookup.pop(id) Gcavelookup.pop(id)
print(message) print(message)
DataIssue.objects.create(parser='caves', message=message) DataIssue.objects.create(parser='aliases', message=message)
global Gcavelookup global Gcavelookup
if Gcavelookup: if Gcavelookup:
@ -600,6 +600,8 @@ def GetCaveLookup():
global Gcave_count global Gcave_count
Gcave_count = defaultdict(int) # sets default value to int(0) Gcave_count = defaultdict(int) # sets default value to int(0)
DataIssue.objects.filter(parser='aliases').delete()
for cave in Cave.objects.all(): for cave in Cave.objects.all():
key = cave.official_name.lower() key = cave.official_name.lower()
if key != "" and key != "unamed" and key != "unnamed": if key != "" and key != "unamed" and key != "unnamed":
@ -762,7 +764,7 @@ def GetCaveLookup():
else: else:
message = f" * Coding or cave existence mistake, cave for id '{i[1]}' does not exist. Expecting to set alias '{i[0]}' to it" message = f" * Coding or cave existence mistake, cave for id '{i[1]}' does not exist. Expecting to set alias '{i[0]}' to it"
#print(message) #print(message)
DataIssue.objects.create(parser='caves', message=message) DataIssue.objects.create(parser='aliases', message=message)
addmore = {} addmore = {}
for id in Gcavelookup: for id in Gcavelookup:
@ -772,19 +774,12 @@ def GetCaveLookup():
Gcavelookup = {**addmore, **Gcavelookup} Gcavelookup = {**addmore, **Gcavelookup}
addmore ={} addmore ={}
# for id in Gcavelookup:
# if not Gcavelookup[id]:
# pass
# elif Gcavelookup[id].kataster_number:
# addmore[id] = Gcavelookup[id].kataster_number
# elif Gcavelookup[id].unofficial_number:
# addmore[id] = Gcavelookup[id].unofficial_number.lower()
for c in Gcave_count: for c in Gcave_count:
if Gcave_count[c] > 1: if Gcave_count[c] > 1:
message = f" ** Duplicate cave id count={Gcave_count[c]} id:'{Gcavelookup[c]}' cave __str__:'{c}'" message = f" ** Duplicate cave id count={Gcave_count[c]} id:'{Gcavelookup[c]}' cave __str__:'{c}'"
print(message) print(message)
DataIssue.objects.create(parser='caves', message=message) DataIssue.objects.create(parser='aliases', message=message)
# logdataissues[Gcavelookup[c]]=message # pending troggle-wide issues logging system # logdataissues[Gcavelookup[c]]=message # pending troggle-wide issues logging system
return Gcavelookup return Gcavelookup