Commit 0c3c0a31 authored by Julian Rother's avatar Julian Rother
Browse files

Merge branch 'master' of git.fsmpi.rwth-aachen.de:videoaginfra/website

parents 53be1719 0fc6db5b
before_script:
- apt update
- apt install -y python3
- python3 -V
- uname -a
unittest:
image: debian:stretch
stage: test
script:
- apt update
- apt install -y python3
- python3 -V
- uname -a
- apt install -y sqlite3 locales-all git python3-flask python3-ldap3 python3-requests python3-lxml python3-icalendar python3-mysql.connector python3-requests python3-coverage
- python3 -m coverage run tests.py
- python3 -m coverage report --include "./*"
......@@ -23,5 +21,16 @@ livetest:
image: debian:stretch
stage: test
script:
- apt update
- apt install -y python3
- python3 -V
- uname -a
- apt install -y python3-requests
- ./tests/urlcheck_sinf.py
\ No newline at end of file
# - ./tests/urlcheck_sinf.py
deploy_staging:
image: archlinux/base
stage: deploy
script:
- pacman --noconfirm -Sy ansible git
\ No newline at end of file
......@@ -206,7 +206,11 @@ def index():
@register_navbar('Videos', icon='film')
def courses():
courses = query('SELECT * FROM courses WHERE (? OR (visible AND listed)) ORDER BY lower(semester), lower(title)', ismod())
chapters = {}
for i in query('SELECT lectures.course_id AS id, COUNT(chapters.id) AS c FROM chapters JOIN lectures ON chapters.lecture_id = lectures.id WHERE NOT chapters.visible AND NOT chapters.deleted GROUP BY lectures.course_id'):
chapters[i['id']] = i['c']
for course in courses:
course['chapter_count'] = chapters.get(course['id'], 0)
if course['semester'] == '':
course['semester'] = 'zeitlos'
groupedby = request.args.get('groupedby')
......@@ -224,11 +228,15 @@ def course(id=None, handle=None):
course = query('SELECT * FROM courses WHERE handle = ? AND (? OR visible)', handle, ismod())[0]
course['perm'] = query('SELECT * FROM perm WHERE (NOT perm.deleted) AND course_id = ? ORDER BY type', course['id'])
perms = query('SELECT perm.* FROM perm JOIN lectures ON (perm.lecture_id = lectures.id) WHERE (NOT perm.deleted) AND lectures.course_id = ? ORDER BY perm.type', course['id'])
chapters = {}
for i in query('SELECT lectures.id AS id, COUNT(chapters.id) AS c FROM chapters JOIN lectures ON chapters.lecture_id = lectures.id WHERE lectures.course_id = ? AND NOT chapters.visible AND NOT chapters.deleted GROUP BY chapters.lecture_id;', course['id']):
chapters[i['id']] = i['c']
lectures = query('SELECT * FROM lectures WHERE course_id = ? AND (? OR visible) ORDER BY time, duration DESC', course['id'], ismod())
for lecture in lectures:
lecture['perm'] = []
lecture['perm'] += course['perm']
lecture['course'] = course
lecture['chapter_count'] = chapters.get(lecture['id'], 0)
for perm in perms:
if perm['lecture_id'] == lecture['id']:
lecture['perm'].append(perm)
......
......@@ -167,7 +167,7 @@
</li>
{% if ismod() or config.DEBUG %}
<li class="pull-right">
<a target="_blank" href="https://git.fsmpi.rwth-aachen.de/videoagwebsite/videoagwebsite/commit/{{ gitversion.longhash }}"><span title="{{ gitversion.branch }} {{ gitversion.hash }}: {{ gitversion.msg }}" data-toggle="tooltip">{{ gitversion.hash }}</span></a>
<a target="_blank" href="https://git.fsmpi.rwth-aachen.de/videoaginfra/website/commit/{{ gitversion.longhash }}"><span title="{{ gitversion.branch }} {{ gitversion.hash }}: {{ gitversion.msg }}" data-toggle="tooltip">{{ gitversion.hash }}</span></a>
<span>{{ gethostname() }}</span>
{% if is_readonly() %}
<span>(read-only)</span>
......
......@@ -71,7 +71,7 @@
{% if groupedby == 'semester' %}
{{ course_list_item(i) }}
{% else %}
{{ course_list_item(i,true) }}
{{ course_list_item(i, true) }}
{% endif %}
{% endfor %}
</ul>
......
......@@ -155,6 +155,9 @@ $(function() {
<a href="{{url_for('course', handle=course.handle)}}">
{{ course.title }}{% if ismod() %}<i> ({{course.id}})</i>{% endif %}
</a>
{% if course.chapter_count|d(0) > 0 and ismod() %}
<span class="label label-info" data-toggle="tooltip" title="Nicht freigegebene Kapitel">{{ course.chapter_count }}</span>
{% endif %}
</span>
<span class="col-xs-8 col-md-3">
{{ course.organizer }}
......@@ -216,7 +219,13 @@ $('#embedcodebtn').popover(
{% endif %}
</div>
<ul class="list-unstyled col-sm-3 col-xs-12">
<li>{{ moderator_editor(['lectures',lecture.id,'title'], lecture.title) }}{{livelabel((lecture.live and lecture.time > datetime.now()-timedelta(days=1)), videos|selectattr("livehandle")|list|length)}}</li>
<li>
{{ moderator_editor(['lectures',lecture.id,'title'], lecture.title) }}
{{ livelabel((lecture.live and lecture.time > datetime.now()-timedelta(days=1)), videos|selectattr("livehandle")|list|length) }}
{% if lecture.chapter_count|d(0) > 0 and ismod() %}
<span class="label label-info" data-toggle="tooltip" title="Nicht freigegebene Kapitel">{{ lecture.chapter_count }}</span>
{% endif %}
</li>
{% if lecture.speaker or ismod() %}<li>Gehalten von {{ moderator_editor(['lectures',lecture.id,'speaker'], lecture.speaker) }}</li>{% endif %}
{% if ismod() %}
<li>{{ moderator_editor(['lectures',lecture.id,'time'], lecture.time) }} </li>
......@@ -263,7 +272,13 @@ $('#embedcodebtn').popover(
<div class="col-sm-2 col-xs-12">
</div>
<ul class="list-unstyled col-sm-3 col-xs-12">
<li>{{ moderator_editor(['lectures',lecture.id,'title'], lecture.title) }}{{livelabel((lecture.live and lecture.time > datetime.now()-timedelta(days=1)), videos|selectattr("livehandle")|list|length)}}</li>
<li>
{{ moderator_editor(['lectures',lecture.id,'title'], lecture.title) }}
{{livelabel((lecture.live and lecture.time > datetime.now()-timedelta(days=1)), videos|selectattr("livehandle")|list|length)}}
{% if lecture.chapter_count|d(0) > 0 and ismod() %}
<span class="label label-info" data-toggle="tooltip" title="Nicht freigegebene Kapitel">{{ lecture.chapter_count }}</span>
{% endif %}
</li>
</ul>
<ul class="list-unstyled col-sm-3 col-xs-12">
{% if ismod() %}
......
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