From ef32bf5e2d3472034209468fdb7bbddd0b666e41 Mon Sep 17 00:00:00 2001
From: Andreas Valder <andreasv@fsmpi.rwth-aachen.de>
Date: Sun, 4 Sep 2016 19:27:15 +0200
Subject: [PATCH] removed set local made import better

---
 importer.py                  | 7 ++++---
 server.py                    | 5 +----
 templates/import_campus.html | 3 +++
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/importer.py b/importer.py
index 88bd070..36866ce 100755
--- a/importer.py
+++ b/importer.py
@@ -80,9 +80,10 @@ def import_from(source=None, id=None):
 					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'];
-					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)
-			# it is pared.
+			# it is parsed.
 
 
 
@@ -102,7 +103,7 @@ def import_from(source=None, id=None):
 
 	for i in lectures:
 		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'])
 			if i['hascampusmapping']:
 				break
diff --git a/server.py b/server.py
index 8b6f522..77d77d4 100755
--- a/server.py
+++ b/server.py
@@ -5,11 +5,8 @@ from datetime import date, timedelta, datetime, time, MINYEAR
 import threading
 import os
 import hashlib
-import locale
 import random
 
-locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
-
 app = Flask(__name__)
 
 app.jinja_env.trim_blocks = True
@@ -112,7 +109,7 @@ def human_semester(s, long=False):
 
 @app.template_filter(name='date')
 def human_date(d):
-	return d.strftime('%x')
+	return d.strftime('%d.%m.%Y')
 
 @app.template_filter()
 def rfc3339(d):
diff --git a/templates/import_campus.html b/templates/import_campus.html
index c37be8d..6471f47 100644
--- a/templates/import_campus.html
+++ b/templates/import_campus.html
@@ -62,6 +62,9 @@
 		<ul class="list-group-item">
 			{% for i in events|sort(attribute='time') %}
 				<li class="list-group-item row">
+					<span class="col-xs-12">
+						{{i|pprint}}
+					</span>
 					<span class="col-xs-3">
 						Time: {{i.time}}
 					</span>
-- 
GitLab