Commit 6bb2fe36 authored by Julian Rother's avatar Julian Rother
Browse files

Implemented fancy semester naming

parent 31a90ae3
......@@ -7,7 +7,7 @@ import os
import hashlib
import locale
locale.setlocale(locale.LC_ALL, 'de_DE')
locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
app = Flask(__name__)
......@@ -94,8 +94,20 @@ def handle_not_found(e):
return render_endpoint('index', 'Diese Seite existiert nicht!'), 404
def human_semester(s):
return s
def human_semester(s, long=False):
if not s or s == 'zeitlos' or len(s) != 6:
return 'Zeitlos'
year = s[0:4]
semester = s[4:6].upper()
if not year.isdigit() or semester not in ['SS', 'WS']:
print('Invalid semester string "%s"'%s)
return '??'
if not long:
return semester+year[2:]
elif semester == 'SS':
return 'Sommersemester %s'%year
return 'Wintersemester %s/%s'%(year, str(int(year)+1)[2:])
def human_date(d):
......@@ -20,7 +20,11 @@
<div class="row panel-group">
<div class="col-xs-12"><div class="panel panel-default">
<div class="panel-heading">
{% if groupedby == 'semester' %}
<h1 class="panel-title">{{g.grouper|semester(long=True)}}</h1>
{% else %}
<h1 class="panel-title">{{g.grouper}}</h1>
{% endif %}
<ul class="{% if not ismod() %}courses-list {% endif %}list-group">
{% for i in g.list %}
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