2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-29 05:11:52 +00:00
This commit is contained in:
Philip Sargent 2023-10-15 18:39:00 +03:00
parent c51c2326fe
commit a786f4813f
3 changed files with 18 additions and 6 deletions

View File

@ -651,6 +651,7 @@ def GetCaveLookup():
# 1626 aliases # 1626 aliases
("langgustl", "1626-354"), ("langgustl", "1626-354"),
("2018-dm-07", "1626-359"), ("2018-dm-07", "1626-359"),
("1626-2018-dm-07", "1626-359"),
("homecoming", "2018-dm-07"), ("homecoming", "2018-dm-07"),
("heimkommen", "2018-dm-07"), ("heimkommen", "2018-dm-07"),
("Heimkehr", "2018-dm-07"), ("Heimkehr", "2018-dm-07"),

View File

@ -125,17 +125,19 @@ def getnotablecaves():
def caveindex(request): def caveindex(request):
#allcaves = Cave.objects.all() """Should use Django order-by for lazy sorting, not here. But only after we have a proper slug system in place for Caves
allcaves = Cave.objects.filter(areacode="1626") # testing with subset """
for c in allcaves: # allcaves = Cave.objects.all()
if c.entrances: # for c in allcaves:
pass # if c.entrances:
# pass
caves1623 = list(Cave.objects.filter(areacode="1623")) caves1623 = list(Cave.objects.filter(areacode="1623"))
caves1624 = list(Cave.objects.filter(areacode="1624")) caves1624 = list(Cave.objects.filter(areacode="1624"))
caves1626 = list(Cave.objects.filter(areacode="1626")) caves1626 = list(Cave.objects.filter(areacode="1626"))
caves1627 = list(Cave.objects.filter(areacode="1627")) caves1627 = list(Cave.objects.filter(areacode="1627"))
caves1623.sort(key=caveKey) caves1623.sort(key=caveKey)
caves1624.sort(key=caveKey)
caves1626.sort(key=caveKey) caves1626.sort(key=caveKey)
caves1627.sort(key=caveKey) caves1627.sort(key=caveKey)
return render( return render(

View File

@ -472,6 +472,13 @@ def read_entrance(filename, ent=None):
contents = f.read() contents = f.read()
context = filename context = filename
# validate filename, check areacode
ent_area = filename[:4]
if ent_area not in AREACODES:
message = f'! BAD AREA CODE in "{filename}". Not recognised.'
DataIssue.objects.create(parser="entrances", message=message, url=f"/entrance_data/{filename}_edit")
print(message)
entrancecontentslist = getXML(contents, "entrance", maxItems=1, context=context) entrancecontentslist = getXML(contents, "entrance", maxItems=1, context=context)
if len(entrancecontentslist) != 1: if len(entrancecontentslist) != 1:
message = f'! BAD ENTRANCE DATA in "{filename}". More than one entrance. Edit file manually, click.' message = f'! BAD ENTRANCE DATA in "{filename}". More than one entrance. Edit file manually, click.'
@ -840,7 +847,9 @@ def readcaves():
with open(fpending, "r") as fo: with open(fpending, "r") as fo:
cids = fo.readlines() cids = fo.readlines()
for cid in cids: for cid in cids:
pending.add(cid.strip().rstrip("\n")) pcaveid = cid.strip().rstrip("\n")
if pcaveid !="":
pending.add(pcaveid)
with transaction.atomic(): with transaction.atomic():
print(" - Deleting Caves and Entrances") print(" - Deleting Caves and Entrances")