Skip to content

Commit

Permalink
fix: handle missing local names gracefully in lokaleDagsorden function
Browse files Browse the repository at this point in the history
  • Loading branch information
vidigi committed Nov 12, 2024
1 parent 6ee4a2b commit b1317ce
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions apps/api/lectio/_ledigeLokaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def lokaleDagsorden(self, kunAktuelAfdeling=True):
if requests - int(requests) == 0:
requests = int(requests)
else:
requests = int(requests + 1) # +1 for at runde op
requests = int(requests + 1)

urls = []
today = datetime.now().strftime("%Y-%m-%d")
Expand Down Expand Up @@ -92,8 +92,12 @@ def lokaleDagsorden(self, kunAktuelAfdeling=True):
_lokaler = info[4].text.split("\r\n")
for lokale in _lokaler:
if modulDict["status"] != "aflyst":
lokaleList[lokaleNavne.index(lokale)]["moduler"].append(
modulDict["tidspunkt"]
)
print(lokale)
try:
lokaleList[lokaleNavne.index(lokale)]["moduler"].append(
modulDict["tidspunkt"]
)
except:
pass # pass hvis lokale ikke er i lokaleList

return lokaleList

0 comments on commit b1317ce

Please sign in to comment.