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

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

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