verfügbare Kurse korrigiert
This commit is contained in:
parent
7a4a2b5fe6
commit
9d2d9ac314
@ -19,7 +19,7 @@ from werkzeug.security import check_password_hash, generate_password_hash
|
|||||||
from config import Config, COUNTRY_VAT_LABELS
|
from config import Config, COUNTRY_VAT_LABELS
|
||||||
from db import get_connection, fetchone_dict, fetchall_dict
|
from db import get_connection, fetchone_dict, fetchall_dict
|
||||||
from auth import login_required
|
from auth import login_required
|
||||||
from permissions import is_video_allowed_for_level
|
from permissions import is_video_allowed_for_level, is_course_allowed_for_level
|
||||||
from security import (
|
from security import (
|
||||||
admin_required,
|
admin_required,
|
||||||
get_current_user,
|
get_current_user,
|
||||||
@ -236,19 +236,21 @@ def get_available_courses_for_user():
|
|||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
|
|
||||||
cur.execute("""
|
cur.execute("""
|
||||||
SELECT id, code, title, description, video_file, min_level, sort_order
|
SELECT id, code, title, description, video_file, sort_order
|
||||||
FROM course
|
FROM course
|
||||||
WHERE is_active = TRUE
|
WHERE is_active = TRUE
|
||||||
AND min_level <= %s
|
|
||||||
ORDER BY sort_order, code
|
ORDER BY sort_order, code
|
||||||
""", (mandant_level,))
|
""")
|
||||||
|
|
||||||
courses = fetchall_dict(cur)
|
all_courses = fetchall_dict(cur)
|
||||||
|
|
||||||
cur.close()
|
cur.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
return courses
|
return [
|
||||||
|
course for course in all_courses
|
||||||
|
if is_course_allowed_for_level(course["code"], mandant_level)
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user