Commit ef32bf5e authored by Andreas Valder's avatar Andreas Valder
Browse files

removed set local

made import better
parent bffb4913
...@@ -80,9 +80,10 @@ def import_from(source=None, id=None): ...@@ -80,9 +80,10 @@ def import_from(source=None, id=None):
e['time'] = datetime.strptime("%s %s"%(k,j['start']) ,fmt) 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['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']; e['place'] = query("SELECT name FROM places WHERE (campus_name = ?) OR ((NOT campus_name) AND name = ?)",j['place'],j['place'])[0]['name'];
e['exists'] = query("SELECT count(id) as c from lectures WHERE (time = ?) and (duration = ?) and (place = ?) and (course_id = ?)",e['time'],e['duration'],e['place'],id)[0]['c'] > 0 e['title'] = i['type']
e['exists'] = len(query("SELECT id from lectures WHERE (time = ?) and (duration = ?) and (place = ?) and (course_id = ?)",e['time'],e['duration'],e['place'],id)) > 0
events.append(e) events.append(e)
# it is pared. # it is parsed.
...@@ -102,7 +103,7 @@ def import_from(source=None, id=None): ...@@ -102,7 +103,7 @@ def import_from(source=None, id=None):
for i in lectures: for i in lectures:
i['hascampusmapping'] = False i['hascampusmapping'] = False
for j in uniqueevents: for j in events:
i['hascampusmapping'] = (i['place'] == j['place']) and (i['time'] == j['time']) and (i['duration'] == j['duration']) i['hascampusmapping'] = (i['place'] == j['place']) and (i['time'] == j['time']) and (i['duration'] == j['duration'])
if i['hascampusmapping']: if i['hascampusmapping']:
break break
......
...@@ -5,11 +5,8 @@ from datetime import date, timedelta, datetime, time, MINYEAR ...@@ -5,11 +5,8 @@ from datetime import date, timedelta, datetime, time, MINYEAR
import threading import threading
import os import os
import hashlib import hashlib
import locale
import random import random
locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
app = Flask(__name__) app = Flask(__name__)
app.jinja_env.trim_blocks = True app.jinja_env.trim_blocks = True
...@@ -112,7 +109,7 @@ def human_semester(s, long=False): ...@@ -112,7 +109,7 @@ def human_semester(s, long=False):
@app.template_filter(name='date') @app.template_filter(name='date')
def human_date(d): def human_date(d):
return d.strftime('%x') return d.strftime('%d.%m.%Y')
@app.template_filter() @app.template_filter()
def rfc3339(d): def rfc3339(d):
......
...@@ -62,6 +62,9 @@ ...@@ -62,6 +62,9 @@
<ul class="list-group-item"> <ul class="list-group-item">
{% for i in events|sort(attribute='time') %} {% for i in events|sort(attribute='time') %}
<li class="list-group-item row"> <li class="list-group-item row">
<span class="col-xs-12">
{{i|pprint}}
</span>
<span class="col-xs-3"> <span class="col-xs-3">
Time: {{i.time}} Time: {{i.time}}
</span> </span>
......
Supports Markdown
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