Commit cde4f61f authored by Andreas Valder's avatar Andreas Valder Committed by Andreas Valder
Browse files

made "nächste aufnahmen" show the next week only

parent 0de13221
......@@ -127,12 +127,14 @@ def fixnl(s):
@app.route('/')
@register_navbar('Home', icon='home')
def index():
start = date.today() - timedelta(days=1)
end = start + timedelta(days=7)
upcomming = query ('''
SELECT lectures.*,courses.short, courses.title AS course_title
FROM lectures
JOIN courses ON (lectures.course_id = courses.id)
WHERE (time > ?)
ORDER BY time ASC LIMIT 7''',datetime.today())
WHERE (time > ?) AND (time < ?) and lectures.visible and courses.visible and courses.listed
ORDER BY time ASC LIMIT 30''',start,end)
for i in upcomming:
i['date'] = i['time'].date()
latestvideos=query('''
......
......@@ -69,21 +69,25 @@
<div class="panel-heading">
<h1 class="panel-title">Nächste Aufnahmen</h1">
</div>
<ul class="list-group">
{% for g in upcomming|groupby('date') %}
<li class="list-group-item">
<ul class="list-group" style="margin: 0px;">
<strong>{{ g.grouper|date }}</strong>
{% for i in g.list %}
<li class="list-group-item list-group-item-condensed">
{{i.time|time}} {{i.place}} <a href="{{url_for('course', id=i.course_id)}}">{{i.course_title}}</a>: <a href="{{url_for('course', id=i.course_id)}}#lecture-{{i.id}}">{{i.title}}</a>
{% if upcomming|length > 0 %}
<ul class="list-group">
{% for g in upcomming|groupby('date') %}
<li class="list-group-item">
<ul class="list-group" style="margin: 0px;">
<strong>{{ g.grouper|date }}</strong>
{% for i in g.list %}
<li class="list-group-item list-group-item-condensed">
{{i.time|time}} {{i.place}} <a href="{{url_for('course', id=i.course_id)}}">{{i.course_title}}</a>: <a href="{{url_for('course', id=i.course_id)}}#lecture-{{i.id}}">{{i.title}}</a>
</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
{% else %}
<p>In den nächsten 7 Tagen wird noch nichts aufgenommen oder gestreamt.</p>
{% endif %}
</div>
<div class="panel panel-default">
<div class="panel-heading">
......
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