Skip to content
Snippets Groups Projects
Commit 899b7632 authored by Julian Rother's avatar Julian Rother
Browse files

Correct place names in ro-import

parent f9f059d9
No related branches found
No related tags found
Loading
......@@ -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']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment