2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-25 16:51:54 +00:00

more dead chicken waving

This commit is contained in:
Philip Sargent 2022-07-21 21:52:10 +03:00
parent f46942fadf
commit 796dbf1438
3 changed files with 7 additions and 7 deletions

View File

@ -44,7 +44,7 @@ class Area(TroggleModel):
short_name = models.CharField(max_length=100)
name = models.CharField(max_length=200, blank=True, null=True)
description = models.TextField(blank=True, null=True)
parent = models.ForeignKey('Area', blank=True, null=True, on_delete=models.SET_NULL)
super = models.ForeignKey('Area', blank=True, null=True, on_delete=models.SET_NULL)
def __str__(self):
if self.parent:
@ -231,9 +231,9 @@ class Cave(TroggleModel):
areas = self.area.all()
lowestareas = list(areas)
for area in areas:
if area.parent in areas:
if area.super in areas:
try:
lowestareas.remove(area.parent)
lowestareas.remove(area.super)
except:
pass
return lowestareas[0]

View File

@ -187,10 +187,10 @@ def readcaves():
print(" - Creating Areas 1623 and 1626")
# This crashes on the server with MariaDB even though a null parent is explicitly allowed.
area_1623= Area.objects.create(short_name = "1623", parent=None)
area_1623= Area.objects.create(short_name = "1623", super=None)
print(" - Saving Area 1623")
area_1623.save()
area_1626= Area.objects.create(short_name = "1626", parent=None)
area_1626= Area.objects.create(short_name = "1626", super=None)
print(" - Saving Area 1626")
area_1626.save()
@ -402,7 +402,7 @@ def readcave(filename):
if area:
newArea = area[0]
else:
newArea = Area(short_name = area_slug, parent = Area.objects.get(short_name = "1623"))
newArea = Area(short_name = area_slug, super = Area.objects.get(short_name = "1623"))
newArea.save()
areas_xslug[area_slug] = newArea
c.area.add(newArea)

View File

@ -75,7 +75,7 @@ class MapLocations(object):
try:
areaName = k.getArea().short_name
except:
message = " ! Failed to get Area on cave '{}' linked to Entrance:{} from:{} best:{}".format(cave, ent.name, ent.filename, ent.best_station())
message = " ! Failed to get Area on cave '{}' linked to Entrance:{} from:{} best:{}".format(k, ent.name, ent.filename, ent.best_station())
DataIssue.objects.create(parser='entrances', message=message)
print(message)
raise