def API_V1_problem_manage__get_testdb(): process_time = time.time() CLASS_ID = request.get_json()['class_id'] if check_class_admin(g.db, CLASS_ID, get_jwt_identity()): try: result = get_testdb(g.db, CLASS_ID) status = "success" except: result = status = "fail" else: status = "success" result = "Access denied" process_time = time.time() - process_time return jsonify(API_STATUS=status, RESULT=result, PROCESS_TIME=process_time)
def API_V1_class_manage__push_user(): process_time = time.time() CLASS_ID = request.get_json()['class_id'] USER_LIST = request.get_json()['user_list'] if check_class_admin(g.db, CLASS_ID, get_jwt_identity()): try: result = push_user(g.db, CLASS_ID, USER_LIST) status = "success" except: result = status = "fail" else: status = "success" result = "Access denied" process_time = time.time() - process_time return jsonify(API_STATUS=status, RESULT=result, PROCESS_TIME=process_time)
def API_V1_problem_manage__create_problem_group(): process_time = time.time() class_id = request.get_json()['class_id'] pg_title = request.get_json()['pg_title'] if check_class_admin(g.db, class_id, get_jwt_identity()): try: result = create_problem_group(g.db, class_id, pg_title) status = "success" except: result = status = "fail" else: status = "success" result = "Access denied" process_time = time.time() - process_time return jsonify(API_STATUS=status, RESULT=result, PROCESS_TIME=process_time)
def API_V1_problem_manage__update_problem(): process_time = time.time() CLASS_ID = request.get_json()['class_id'] p_id = request.get_json()['p_id'] p_title = request.get_json()['p_title'] p_content = request.get_json()['p_content'] p_answer = request.get_json()['p_answer'] if check_class_admin(g.db, CLASS_ID, get_jwt_identity()): try: result = update_problem(g.db, p_id, p_title, p_content, p_answer) status = "success" except: result = status = "fail" else: status = "success" result = "Access denied" process_time = time.time() - process_time return jsonify(API_STATUS=status, RESULT=result, PROCESS_TIME=process_time)
def API_V1_problem_manage__push_testdb(): process_time = time.time() CLASS_ID = request.form['class_id'] FILES = request.files.getlist('file') if check_class_admin(g.db, CLASS_ID, get_jwt_identity()): #파일이 있냐?! if FILES: FILE = FILES[0] #파일 확장자 / 이름길이 체크 file_check = file_name_encode(FILE.filename, get_jwt_identity()) if file_check: FILE.save('./models/testdb_table/' + file_check) try: result = push_testDB(g.db, g.testdb, file_check, CLASS_ID) status = "success" except: result = status = "fail" else: status = "success" result = "Access denied" process_time = time.time() - process_time return jsonify(API_STATUS=status, RESULT=result, PROCESS_TIME=process_time)