mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-29 13:21:54 +00:00
more dead chicken waving
This commit is contained in:
parent
f46942fadf
commit
796dbf1438
@ -44,7 +44,7 @@ class Area(TroggleModel):
|
|||||||
short_name = models.CharField(max_length=100)
|
short_name = models.CharField(max_length=100)
|
||||||
name = models.CharField(max_length=200, blank=True, null=True)
|
name = models.CharField(max_length=200, blank=True, null=True)
|
||||||
description = models.TextField(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):
|
def __str__(self):
|
||||||
if self.parent:
|
if self.parent:
|
||||||
@ -231,9 +231,9 @@ class Cave(TroggleModel):
|
|||||||
areas = self.area.all()
|
areas = self.area.all()
|
||||||
lowestareas = list(areas)
|
lowestareas = list(areas)
|
||||||
for area in areas:
|
for area in areas:
|
||||||
if area.parent in areas:
|
if area.super in areas:
|
||||||
try:
|
try:
|
||||||
lowestareas.remove(area.parent)
|
lowestareas.remove(area.super)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return lowestareas[0]
|
return lowestareas[0]
|
||||||
|
@ -187,10 +187,10 @@ def readcaves():
|
|||||||
|
|
||||||
print(" - Creating Areas 1623 and 1626")
|
print(" - Creating Areas 1623 and 1626")
|
||||||
# This crashes on the server with MariaDB even though a null parent is explicitly allowed.
|
# 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")
|
print(" - Saving Area 1623")
|
||||||
area_1623.save()
|
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")
|
print(" - Saving Area 1626")
|
||||||
area_1626.save()
|
area_1626.save()
|
||||||
|
|
||||||
@ -402,7 +402,7 @@ def readcave(filename):
|
|||||||
if area:
|
if area:
|
||||||
newArea = area[0]
|
newArea = area[0]
|
||||||
else:
|
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()
|
newArea.save()
|
||||||
areas_xslug[area_slug] = newArea
|
areas_xslug[area_slug] = newArea
|
||||||
c.area.add(newArea)
|
c.area.add(newArea)
|
||||||
|
@ -75,7 +75,7 @@ class MapLocations(object):
|
|||||||
try:
|
try:
|
||||||
areaName = k.getArea().short_name
|
areaName = k.getArea().short_name
|
||||||
except:
|
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)
|
DataIssue.objects.create(parser='entrances', message=message)
|
||||||
print(message)
|
print(message)
|
||||||
raise
|
raise
|
||||||
|
Loading…
Reference in New Issue
Block a user