コード例 #1
0
def post_student():
    try:
        s = Student(
            request.form.get('student_id', default=None, type=int),
            request.form.get('student_name', default=None, type=str),
            request.form.get('advisor_id', default=None, type=int),
            request.form.get('approval_status', default=None, type=str),
            request.form.get('thesis_topic', default=None, type=str))
        out = StudentManager.addStudent(s)
    except (AssertionError, KeyError, ValueError) as e:
        out = {"success": False, "desc": str(e)}
    return to_json_response(out)
コード例 #2
0
def update_thesis_topic(student_id: int, thesis_topic: str):
    return to_json_response(
        StudentManager.updateThesisTopic(student_id, thesis_topic))
コード例 #3
0
def approval_rejected(student_id: int):
    return to_json_response(
        StudentManager.updateApprovalStatus(student_id,
                                            StudentManager.CONST_REJECTED))
コード例 #4
0
def approval_accepted(student_id: int):
    return to_json_response(
        StudentManager.updateApprovalStatus(student_id,
                                            StudentManager.CONST_ACCEPTED))
コード例 #5
0
def send_approval_request(student_id: int, advisor_id: int):
    try:
        out = StudentManager.sendApprovalRequest(student_id, advisor_id)
    except (AssertionError, KeyError, ValueError) as e:
        out = {"success": False, "desc": str(e)}
    return to_json_response(out)
コード例 #6
0
def get_student(student_id):
    return to_json_response(StudentManager.getStudent(student_id))
コード例 #7
0
def get_students():
    return to_json_response(StudentManager.getStudents())
コード例 #8
0
def is_student_valid(student_id: int):
    try:
        out = StudentManager.isStudentIdValid(student_id)
    except (AssertionError, KeyError, ValueError) as e:
        out = {"success": False, "desc": str(e)}
    return to_json_response(out)