Commit 985a5447 authored by Christoph Rackwitz's avatar Christoph Rackwitz Committed by Julian Rother
Browse files

cutprogress: fixe Breite; user-gefilterte Ansicht hatte irrelevante Kurse

parent bde747c0
...@@ -11,9 +11,9 @@ def cutprogress(user=None): ...@@ -11,9 +11,9 @@ def cutprogress(user=None):
allsemester = query('SELECT DISTINCT semester from courses ORDER BY semester DESC') allsemester = query('SELECT DISTINCT semester from courses ORDER BY semester DESC')
semester = request.values.get('semester', allsemester[0]['semester']) semester = request.values.get('semester', allsemester[0]['semester'])
# column headers: courses # find courses for semester
courses = query(''' courses = query('''
SELECT courses.id, courses.handle, courses.short, courses.responsible SELECT courses.id, courses.handle, courses.short
FROM courses FROM courses
WHERE semester = ? WHERE semester = ?
ORDER by id DESC ORDER by id DESC
...@@ -30,28 +30,37 @@ def cutprogress(user=None): ...@@ -30,28 +30,37 @@ def cutprogress(user=None):
''', course['id']) ''', course['id'])
if not people: if not people:
people = [{ 'realname': 'Niemand' }] people = [{ 'realname': 'Niemand', 'id': -1 }]
course['responsible'] = people course['responsible'] = people
# fetch lectures # filter for responsibility
lectures = query(''' if user is not None:
SELECT courses = [
lectures.id, c for c in courses
lectures.course_id, if user in (r['id'] for r in c['responsible'])
lectures.time, DATE(lectures.time) as date, ]
lectures.title,
COUNT(videos.id) as videos_total, # fetch lectures for courses
COUNT(videos.visible) as videos_visible lectures = []
FROM lectures for c in courses:
JOIN courses ON courses.id = lectures.course_id lectures += query('''
LEFT JOIN videos ON lectures.id = videos.lecture_id SELECT
WHERE courses.semester = ? lectures.id,
AND date <= DATE('now') lectures.course_id,
AND NOT lectures.norecording lectures.time, DATE(lectures.time) as date,
GROUP BY lectures.id lectures.title,
ORDER BY date DESC, lectures.time ASC, lectures.id ASC COUNT(videos.id) as videos_total,
''', semester) COUNT(videos.visible) as videos_visible
FROM lectures
JOIN courses ON courses.id = lectures.course_id
LEFT JOIN videos ON lectures.id = videos.lecture_id
WHERE courses.id = ?
AND date <= DATE('now')
AND NOT lectures.norecording
GROUP BY lectures.id
ORDER BY date DESC, lectures.time ASC, lectures.id ASC
''', c['id'])
# sort dates, figure out when weeks change # sort dates, figure out when weeks change
dates = sorted({ dates = sorted({
......
...@@ -137,7 +137,12 @@ th.rotate { ...@@ -137,7 +137,12 @@ th.rotate {
th.rotate > div { th.rotate > div {
transform: transform:
rotate(270deg) rotate(270deg)
translate(-50px,0px); translate(-100px,0px);
width: 30px;
}
th.rotate > div > span {
padding: 5px 10px;
} }
.tooltip-inner { .tooltip-inner {
...@@ -145,6 +150,10 @@ th.rotate > div { ...@@ -145,6 +150,10 @@ th.rotate > div {
} }
#cutprogress td {
white-space: nowrap;
}
#cutprogress.table tr.weekbreak td { #cutprogress.table tr.weekbreak td {
border-top: 2px solid black !important; border-top: 2px solid black !important;
} }
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
Datum Datum
</th> </th>
{% for course in courses %} {% for course in courses %}
<th class="text-center rotate"> <th class="rotate">
<div> <div>
<a title="Zuständig: {{ course.responsible|join(attribute='realname') }}" href="{{ url_for("course", handle=course.handle) }}">{{ course.short }}</a> <span><a title="Zuständig: {{ course.responsible|join(attribute='realname') }}" href="{{ url_for("course", handle=course.handle) }}">{{ course.short }}</a></span>
</div> </div>
</th> </th>
{% endfor %} {% endfor %}
......
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