from django.db.models import Q

from vbv_lernwelt.core.constants import ADMIN_USER_ID
from vbv_lernwelt.course.models import CourseSessionUser


def feedback_users(course_session_id):
    """
    Solely accept feedback originating from members of the course session and the illustrious
    administrative user, who serves as the repository for feedbacks heretofore submitted anonymously ;-)
    """
    return CourseSessionUser.objects.filter(
        Q(course_session_id=course_session_id, role=CourseSessionUser.Role.MEMBER)
        | Q(user__id=ADMIN_USER_ID)
    ).values_list("user", flat=True)
