Skip to content
Snippets Groups Projects
Commit a6fd310f authored by Andreas Valder's avatar Andreas Valder
Browse files

fixed campus importer

parent 82d26dd2
Branches
No related tags found
No related merge requests found
......@@ -63,6 +63,7 @@ def import_from(source=None, id=None):
events_raw.append(rowdata)
# parse single appointments
if basetable.xpath("//table[@cellpadding='3']/tr/td[text()='Einmalige Termine:']"):
singletable = basetable.xpath("//table[@cellpadding='3']/tr/td[text()='Einmalige Termine:']")[0].getparent().getparent()
for row in singletable.xpath("tr/td[2]"):
rowdata = {}
......@@ -79,7 +80,11 @@ def import_from(source=None, id=None):
fmt= "%d.%m.%Y %H:%M"
e['time'] = datetime.strptime("%s %s"%(k,j['start']) ,fmt)
e['duration'] = int((datetime.strptime("%s %s"%(k,j['end']) ,fmt) - e['time']).seconds/60)
e['place'] = query("SELECT name FROM places WHERE (campus_name = ?) OR ((NOT campus_name) AND name = ?)",j['place'],j['place'])[0]['name'];
dbplace = query("SELECT name FROM places WHERE (campus_name = ?) OR ((NOT campus_name) AND name = ?)",j['place'],j['place'])
if dbplace:
e['place'] = dbplace[0]['name']
else:
e['place'] = 'Unbekannter Ort ('+j['place']+')'
e['title'] = i['type']
events.append(e)
# it is parsed.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment