From eddd5a66f6f0b030d1cc9d52d18e8d8066329277 Mon Sep 17 00:00:00 2001
From: Andreas <andreasv@fsmpi.rwth-aachen.de>
Date: Mon, 29 Jan 2018 20:14:30 +0100
Subject: [PATCH] fixing html syntax in the timetable

---
 templates/import_campus.html | 4 ++--
 templates/timetable.html     | 2 +-
 timetable.py                 | 3 +--
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/templates/import_campus.html b/templates/import_campus.html
index ecda839..11e0e87 100644
--- a/templates/import_campus.html
+++ b/templates/import_campus.html
@@ -18,7 +18,7 @@
 								<input class="form-control" type="text" name="campus.{{i.id}}.url" value="{{i.url}}" id="campus-{{i.id}}-url" placeholder="url">
 							</span>
 							<span class="input-group col-xs-2">
-								<input class="form-control" type="test" name="campus.{{i.id}}.type" value="{{i.type}}" id="campus-{{i.id}}-type" placeholder="type">
+								<input class="form-control" type="text" name="campus.{{i.id}}.type" value="{{i.type}}" id="campus-{{i.id}}-type" placeholder="type">
 							</span>
 							<span class="input-group col-xs-1 pull-right">
 								<button class="btn btn-default pull-right" onclick="$('#campus-{{i.id}}-url').val('')">
@@ -32,7 +32,7 @@
 								<input class="form-control" type="text" name="campus.new.url" placeholder="url">
 							</span>
 							<span class="input-group col-xs-2">
-								<input class="form-control" type="test" name="campus.new.type" placeholder="type">
+								<input class="form-control" type="text" name="campus.new.type" placeholder="type">
 							</span>
 							<span class="input-group col-xs-1 pull-right">
 								<button class="btn btn-default pull-right">
diff --git a/templates/timetable.html b/templates/timetable.html
index f00f55f..fe6ab37 100644
--- a/templates/timetable.html
+++ b/templates/timetable.html
@@ -46,7 +46,7 @@
 					{% set time_index = loop.index %}
 					<tr{% if t.strftime("%M") == "00" %} class="hourlytime"{% endif %}>
 						{# display time in first row if its a full hour #}
-						{% if ((time_index - 1) is divisibleby 4) %} <td rowspan="4" style="vertical-align: top;">{{ t.strftime("%H:%M") }}</td> {% endif %}
+						{% if ((time_index - 1) is divisibleby 4) %} <td{% if not loop.last %} rowspan="4"{% endif %} style="vertical-align: top;">{{ t.strftime("%H:%M") }}</td>{% endif %}
 						{# iterate over days if if it is a working day or we have lectures on that day (optionaly skip weekends) #}
 						{% for d in days if (d.index < 5) or (d.lectures|length) > 0 %}
 							{% for col in range(1,d.maxcol+1) %}
diff --git a/timetable.py b/timetable.py
index 73d94bc..00f1a89 100644
--- a/timetable.py
+++ b/timetable.py
@@ -24,7 +24,6 @@ def timetable(user=None):
 
 			if not datesweekmonday:
 				kw = 0
-				weekofyear = str(datetime.today().year) + "-W" + str(datetime.today().isocalendar()[1])
 			else:
 				datesweekmonday -= timedelta(days=datesweekmonday.weekday())
 				kw = int((datesweekmonday.date() - thisweekmonday.date()).days/7)
@@ -36,7 +35,7 @@ def timetable(user=None):
 		start = date.today() - timedelta(days=date.today().weekday() -7*kw)
 	except:
 		start = date.today() - timedelta(days=date.today().weekday())
-	weekofyear = str(start.year) + "-W" + str(start.isocalendar()[1])
+	weekofyear = '{}-W{:02d}'.format(datetime.today().year, datetime.today().isocalendar()[1])
 	days = [{'date': start, 'lectures': [], 'atonce':0, 'index': 0 }]
 	earlieststart=time(23,59)
 	latestend=time(0,0)
-- 
GitLab