Exemplo n.º 1
0
def ensure_user_couples_to_course(user, course, user_data):
    """
    Helper for the one time fill function for canvas courses.
    It ensures the user is couples rightly to the course.
    """
    for role in user_data.get('enrollments'):
        role_type = role.get('type')
        if role_type == "StudentEnrollment":
            course.student_courses.append(user)
            break
        elif role_type == "TaEnrollment":
            course.ta_courses.append(user)
            break
        elif role_type == "TeacherEnrollment":
            course.supervisors.append(user)
            break
    database.commitSafelyToDB(func=ensure_user_couples_to_course)
Exemplo n.º 2
0
def link_ta_to_ticket(user, ticket):
    ticket.bound_tas.append(user)
    database.commitSafelyToDB(ticket)
Exemplo n.º 3
0
def link_supervisor_to_course(user, course):
    course.supervisor_courses.append(user)
    database.commitSafelyToDB(course)
Exemplo n.º 4
0
def link_student_to_course(user, course):
    course.student_courses.append(user)
    database.commitSafelyToDB(course)
Exemplo n.º 5
0
def link_ta_to_course(user, course):
    course.ta_courses.append(user)
    database.commitSafelyToDB(course)