Esempio n. 1
0
def get_student_class_schedule():
    saturday_class = StudentClassSchedule.query.filter(
        StudentClassSchedule.class_schedule_id == 3).all()

    enrolled_students = to_json(saturday_class)

    return enrolled_students
Esempio n. 2
0
def get_class_instance(id):
    try:
        class_instance = ClassInstance.query.filter(
            ClassInstance.id == id).one()
    except NoResultFound:
        class_instance = {}

    class_instance = to_json(class_instance)

    return class_instance
Esempio n. 3
0
def update_student_class_instance_attendance(id, attendance):
    try:
        student_class_instance = StudentClassInstance.query.filter(
            StudentClassInstance.id == id).one()
        student_class_instance.attendance = attendance
        db.session.commit()
        result = to_json(student_class_instance)
        return result
    except NoResultFound:
        # TODO add some custom error message here
        pass
Esempio n. 4
0
def get_student_class_instance(class_instance_id):
    student_class_instances = StudentClassInstance.query.filter(
        StudentClassInstance.class_instance_id == class_instance_id).all()
    student_class_instances = to_json(student_class_instances)
    return student_class_instances
Esempio n. 5
0
def get_students():
    students = Student.query.all()
    students = to_json(students)
    return students
Esempio n. 6
0
def test_to_json_empty_dict():
    assert to_json({}) == '{}'
Esempio n. 7
0
def test_to_json_empty_list():
    assert to_json([]) == '[]'
Esempio n. 8
0
def get_class_schedule():
    class_schedule = ClassSchedule.query.all()
    result = to_json(class_schedule)
    return result