Commit 899b7632 authored by Julian Rother's avatar Julian Rother

Correct place names in ro-import

parent f9f059d9
......@@ -151,7 +151,16 @@ def fetch_ro_course_events(item):
if comp.get('STATUS') != 'CONFIRMED':
continue
e = {}
e['place'] = str(comp.get('LOCATION', ''))
place = str(comp.get('LOCATION', ''))
if place:
campus_room = place.split('(')[-1].split(')')[0]
dbplace = query('SELECT name FROM places WHERE campus_room = ?', campus_room)
if dbplace:
e['place'] = dbplace[0]['name']
else:
e['place'] = 'Unbekannter Ort ('+place+')'
else:
e['place'] = ''
e['time'] = comp['DTSTART'].dt.astimezone(localtz).replace(tzinfo=None)
e['duration'] = int((comp['DTEND'].dt - comp['DTSTART'].dt).seconds/60)
e['title'] = item['type']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment