From 83d39362176abdea919f09748f98d081c8014870 Mon Sep 17 00:00:00 2001 From: Julian Rother <julianr@fsmpi.rwth-aachen.de> Date: Sat, 29 Apr 2017 22:44:42 +0200 Subject: [PATCH] Added "external" property for courses (#213) --- db_schema.sql | 3 ++- edit.py | 3 ++- templates/course.html | 1 + timetable.py | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/db_schema.sql b/db_schema.sql index f47c8b9..44ac919 100644 --- a/db_schema.sql +++ b/db_schema.sql @@ -61,7 +61,8 @@ CREATE TABLE IF NOT EXISTS `courses_data` ( `description` text NOT NULL DEFAULT '', `internal` text NOT NULL DEFAULT '', `responsible` text NOT NULL DEFAULT '', - `feed_url` text NOT NULL DEFAULT '' + `feed_url` text NOT NULL DEFAULT '', + `external` INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE IF NOT EXISTS `filesizes` ( `path` varchar(255) NOT NULL PRIMARY KEY, diff --git a/edit.py b/edit.py index 77c8d92..cfd7d1e 100644 --- a/edit.py +++ b/edit.py @@ -25,7 +25,8 @@ editable_tables = { 'internal': {'type': 'text'}, 'responsible': {'type': 'shortstring'}, 'deleted': {'type': 'boolean'}, - 'description': {'type': 'text'} }, + 'description': {'type': 'text'}, + 'external': {'type': 'boolean'}}, 'creationtime_fields': ['created_by', 'time_created', 'time_updated'] }, 'lectures': { 'table': 'lectures_data', diff --git a/templates/course.html b/templates/course.html index 9868782..6bbb9e9 100644 --- a/templates/course.html +++ b/templates/course.html @@ -41,6 +41,7 @@ <tbody> <tr><td>Sichtbar:</td><td>{{ moderator_checkbox(['courses',course.id,'visible'], course.visible) }}</td></tr> <tr><td>Gelistet:</td><td>{{ moderator_checkbox(['courses',course.id,'listed'], course.listed) }}</td></tr> + <tr><td>Nicht im Drehplan:</td><td>{{ moderator_checkbox(['courses',course.id,'external'], course.external) }}</td></tr> <tr><td>Videos downloadbar:</td><td>{{ moderator_checkbox(['courses',course.id,'downloadable'], course.downloadable) }}</td></tr> <tr><td>Short:</td><td>{{ moderator_editor(['courses',course.id,'short'], course.short) }}</td></tr> <tr><td>Handle:</td><td>{{ moderator_editor(['courses',course.id,'handle'], course.handle) }}</td></tr> diff --git a/timetable.py b/timetable.py index 1fee5bb..ad2a54d 100644 --- a/timetable.py +++ b/timetable.py @@ -26,7 +26,7 @@ def timetable(): SELECT lectures.*, courses.short, "course" AS sep, courses.* FROM lectures JOIN courses ON (lectures.course_id = courses.id) - WHERE time < ? AND time > ? AND NOT norecording + WHERE time < ? AND time > ? AND NOT norecording AND NOT external ORDER BY time ASC''', i['date']+timedelta(weeks=2), i['date']-timedelta(weeks=2)): # we can not use the where clause of sql to match against the time, because sqlite and mysql use a different syntax -.- # we still use it to only get the lectures for a 3 week periode -- GitLab