vbv/server/vbv_lernwelt/course_session/utils.py

20 lines
614 B
Python

from vbv_lernwelt.core.models import User
from vbv_lernwelt.course.consts import (
COURSE_VERSICHERUNGSVERMITTLERIN_FR_ID,
COURSE_VERSICHERUNGSVERMITTLERIN_ID,
COURSE_VERSICHERUNGSVERMITTLERIN_IT_ID,
)
from vbv_lernwelt.course.models import CourseSession
def has_course_session_user_vv(user: User) -> bool:
vv_course_ids = [
COURSE_VERSICHERUNGSVERMITTLERIN_ID,
COURSE_VERSICHERUNGSVERMITTLERIN_FR_ID,
COURSE_VERSICHERUNGSVERMITTLERIN_IT_ID,
]
return CourseSession.objects.filter(
course__id__in=vv_course_ids, coursesessionuser__user=user
).exists()