Commit cb01a36e authored by Andreas Valder's avatar Andreas Valder

renamed schedule to timetable

parent fc8f2a4c
......@@ -8,7 +8,6 @@ import sys
import hashlib
import random
import sched
import time
app = Flask(__name__)
......@@ -20,6 +19,7 @@ app.add_template_global(timedelta, name='timedelta')
scheduler = sched.scheduler()
def run_scheduler():
import time
time.sleep(1) # UWSGI does weird things on startup
while True:
scheduler.run()
......@@ -452,7 +452,7 @@ def sitemap():
import feeds
import importer
import schedule
import timetable
import sorter
if 'ICAL_URL' in config:
import meetings
......@@ -7,9 +7,9 @@
</div>
<div class="row hidden-print">
<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('schedule', 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=kw-1) }}" class="pull-left btn btn-default">{{ "<<" }}</a>
<a href="{{url_for('timetable', kw=kw+1) }}" class="pull-right btn btn-default">{{ ">>" }}</a>
<a href="{{url_for('timetable', kw=0) }}" style="width: 80px;" class="center-block btn btn-default">today</a>
</div>
</div>
<div class="panel-body row table-responsive">
......@@ -21,7 +21,7 @@
{% 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 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;">
<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>
......@@ -29,7 +29,7 @@
{{l.place}}</p>
</td>
{% 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 %}
<td></td>
{% endfor %}
......
from server import *
@app.route('/schedule')
@app.route('/timetable')
@register_navbar('Drehplan', icon='calendar')
@mod_required
def schedule():
def timetable():
if 'kw' not in request.args:
kw=0
else:
......@@ -44,12 +44,12 @@ def schedule():
maxcol = curcol
if len(freecol) == 0:
freecol.append(maxcol)
l[2]['schedule_col'] = freecol.pop()
l[2]['timetable_col'] = freecol.pop()
if earlieststart > l[0].time():
earlieststart = l[0].time()
else:
curcol -= 1
freecol.append(l[2]['schedule_col'])
freecol.append(l[2]['timetable_col'])
if latestend < l[0].time():
latestend = l[0].time()
i['maxcol'] = max(maxcol,1)
......@@ -59,4 +59,4 @@ def schedule():
for i in range(s.hour*4,min(int((60*e.hour/15)/4)*4+5,24*4)):
t = i*15
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)
Markdown is supported
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