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

renamed schedule to timetable

parent fc8f2a4c
...@@ -8,7 +8,6 @@ import sys ...@@ -8,7 +8,6 @@ import sys
import hashlib import hashlib
import random import random
import sched import sched
import time
app = Flask(__name__) app = Flask(__name__)
...@@ -20,6 +19,7 @@ app.add_template_global(timedelta, name='timedelta') ...@@ -20,6 +19,7 @@ app.add_template_global(timedelta, name='timedelta')
scheduler = sched.scheduler() scheduler = sched.scheduler()
def run_scheduler(): def run_scheduler():
import time
time.sleep(1) # UWSGI does weird things on startup time.sleep(1) # UWSGI does weird things on startup
while True: while True:
scheduler.run() scheduler.run()
...@@ -452,7 +452,7 @@ def sitemap(): ...@@ -452,7 +452,7 @@ def sitemap():
import feeds import feeds
import importer import importer
import schedule import timetable
import sorter import sorter
if 'ICAL_URL' in config: if 'ICAL_URL' in config:
import meetings import meetings
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
</div> </div>
<div class="row hidden-print"> <div class="row hidden-print">
<div style="margin-top: 10px;" class="col-xs-12"> <div style="margin-top: 10px;" class="col-xs-12">
<a href="{{url_for('schedule', kw=kw-1) }}" class="pull-left btn btn-default">{{ "<<" }}</a> <a href="{{url_for('timetable', kw=kw-1) }}" class="pull-left btn btn-default">{{ "<<" }}</a>
<a href="{{url_for('schedule', kw=kw+1) }}" class="pull-right btn btn-default">{{ ">>" }}</a> <a href="{{url_for('timetable', kw=kw+1) }}" class="pull-right btn btn-default">{{ ">>" }}</a>
<a href="{{url_for('schedule', kw=0) }}" style="width: 80px;" class="center-block btn btn-default">today</a> <a href="{{url_for('timetable', kw=0) }}" style="width: 80px;" class="center-block btn btn-default">today</a>
</div> </div>
</div> </div>
<div class="panel-body row table-responsive"> <div class="panel-body row table-responsive">
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
{% if ((loop.index - 1) is divisibleby 4) %} <td rowspan="4" style="vertical-align: top;">{{ t.strftime("%H:%M") }}</td> {% endif %} {% if ((loop.index - 1) is divisibleby 4) %} <td rowspan="4" style="vertical-align: top;">{{ t.strftime("%H:%M") }}</td> {% endif %}
{% for d in days if (d.index < 5) or (d.lectures|length) > 0 %} {% for d in days if (d.index < 5) or (d.lectures|length) > 0 %}
{% for i in range(1,d.maxcol+1) %} {% for i in range(1,d.maxcol+1) %}
{% for l in d.lectures|selectattr('schedule_col','equalto',i) if (((l.time.time() > t) and (l.time.time() < times[time_loop.index+1])) != (l.time.time() == t ) ) %} {% for l in d.lectures|selectattr('timetable_col','equalto',i) if (((l.time.time() > t) and (l.time.time() < times[time_loop.index+1])) != (l.time.time() == t ) ) %}
<td rowspan="{{l.duration / 15}}" style="background: lightgrey;"> <td rowspan="{{l.duration / 15}}" style="background: lightgrey;">
<p class="small"> <p class="small">
<strong><a class="hidden-print" href="{{url_for('course', id=l.course_id)}}#lecture-{{l.id}}">{{l.short}}</a><span class="visible-print-inline">{{l.short}}</span></strong><br> <strong><a class="hidden-print" href="{{url_for('course', id=l.course_id)}}#lecture-{{l.id}}">{{l.short}}</a><span class="visible-print-inline">{{l.short}}</span></strong><br>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
{{l.place}}</p> {{l.place}}</p>
</td> </td>
{% else %} {% else %}
{% for l in d.lectures|selectattr('schedule_col','equalto',i) if (l.time.time() < t) and (l.time_end.time() > t) %} {% for l in d.lectures|selectattr('timetable_col','equalto',i) if (l.time.time() < t) and (l.time_end.time() > t) %}
{% else %} {% else %}
<td></td> <td></td>
{% endfor %} {% endfor %}
......
from server import * from server import *
@app.route('/schedule') @app.route('/timetable')
@register_navbar('Drehplan', icon='calendar') @register_navbar('Drehplan', icon='calendar')
@mod_required @mod_required
def schedule(): def timetable():
if 'kw' not in request.args: if 'kw' not in request.args:
kw=0 kw=0
else: else:
...@@ -44,12 +44,12 @@ def schedule(): ...@@ -44,12 +44,12 @@ def schedule():
maxcol = curcol maxcol = curcol
if len(freecol) == 0: if len(freecol) == 0:
freecol.append(maxcol) freecol.append(maxcol)
l[2]['schedule_col'] = freecol.pop() l[2]['timetable_col'] = freecol.pop()
if earlieststart > l[0].time(): if earlieststart > l[0].time():
earlieststart = l[0].time() earlieststart = l[0].time()
else: else:
curcol -= 1 curcol -= 1
freecol.append(l[2]['schedule_col']) freecol.append(l[2]['timetable_col'])
if latestend < l[0].time(): if latestend < l[0].time():
latestend = l[0].time() latestend = l[0].time()
i['maxcol'] = max(maxcol,1) i['maxcol'] = max(maxcol,1)
...@@ -59,4 +59,4 @@ def schedule(): ...@@ -59,4 +59,4 @@ def schedule():
for i in range(s.hour*4,min(int((60*e.hour/15)/4)*4+5,24*4)): for i in range(s.hour*4,min(int((60*e.hour/15)/4)*4+5,24*4)):
t = i*15 t = i*15
times.append(time(int(t/60),t%60)) times.append(time(int(t/60),t%60))
return render_template('schedule.html',days=days,times=times,kw=kw) return render_template('timetable.html',days=days,times=times,kw=kw)
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