summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/models/caves.py1
-rw-r--r--core/views/caves.py12
-rw-r--r--parsers/caves.py11
3 files changed, 18 insertions, 6 deletions
diff --git a/core/models/caves.py b/core/models/caves.py
index a731dff..046da43 100644
--- a/core/models/caves.py
+++ b/core/models/caves.py
@@ -651,6 +651,7 @@ def GetCaveLookup():
# 1626 aliases
("langgustl", "1626-354"),
("2018-dm-07", "1626-359"),
+ ("1626-2018-dm-07", "1626-359"),
("homecoming", "2018-dm-07"),
("heimkommen", "2018-dm-07"),
("Heimkehr", "2018-dm-07"),
diff --git a/core/views/caves.py b/core/views/caves.py
index 90a8451..bd559bb 100644
--- a/core/views/caves.py
+++ b/core/views/caves.py
@@ -125,17 +125,19 @@ def getnotablecaves():
def caveindex(request):
- #allcaves = Cave.objects.all()
- allcaves = Cave.objects.filter(areacode="1626") # testing with subset
- for c in allcaves:
- if c.entrances:
- pass
+ """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.all()
+ # for c in allcaves:
+ # if c.entrances:
+ # pass
caves1623 = list(Cave.objects.filter(areacode="1623"))
caves1624 = list(Cave.objects.filter(areacode="1624"))
caves1626 = list(Cave.objects.filter(areacode="1626"))
caves1627 = list(Cave.objects.filter(areacode="1627"))
caves1623.sort(key=caveKey)
+ caves1624.sort(key=caveKey)
caves1626.sort(key=caveKey)
caves1627.sort(key=caveKey)
return render(
diff --git a/parsers/caves.py b/parsers/caves.py
index 1178399..d69273f 100644
--- a/parsers/caves.py
+++ b/parsers/caves.py
@@ -472,6 +472,13 @@ def read_entrance(filename, ent=None):
contents = f.read()
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)
if len(entrancecontentslist) != 1:
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:
cids = fo.readlines()
for cid in cids:
- pending.add(cid.strip().rstrip("\n"))
+ pcaveid = cid.strip().rstrip("\n")
+ if pcaveid !="":
+ pending.add(pcaveid)
with transaction.atomic():
print(" - Deleting Caves and Entrances")