def api_create_asgn(request, sid, cid): """ 创建作业接口 :param request: :param cid: course id :param sid: :return: """ wejudge_session = WeJudgeEducationSession(request) # 创建会话 response = WeJudgeResponse(wejudge_session) # 创建响应 manager = libs.EducationCourseController(request, response, sid) manager.get_course(cid) return response.json(WeJudgeResult(manager.create_asgn()))
def api_course_asgn(request, sid, cid): """ 教学系统课程作业接口 :param request: :param cid: course id :param sid: :return: """ wejudge_session = WeJudgeEducationSession(request) # 创建会话 response = WeJudgeResponse(wejudge_session) # 创建响应 manager = libs.EducationCourseController(request, response, sid) manager.get_course(cid) manager.check_assistant() # 助教提权 return response.json(WeJudgeResult(manager.get_asgn_list()))
def asgn_score_count(request, sid, cid): """ 作业成绩统计 :param request: :param sid: :return: """ wejudge_session = WeJudgeEducationSession(request) # 创建目录 response = WeJudgeResponse(wejudge_session) # 创建相应 manager = libs.EducationCourseController(request, response, sid) manager.get_course(cid) manager.get_asgn_list() result = manager.asgn_score_counter() return response.json(WeJudgeResult(result))
def delete_course(request, sid, cid): """ 删除课程 :param request: :param sid: :param cid: :return: """ wejudge_session = WeJudgeEducationSession(request) # 创建会话 response = WeJudgeResponse(wejudge_session) # 创建响应 manager = libs.EducationCourseController(request, response, sid) manager.get_course(cid) school_id = manager.delete_course() return HttpResponseRedirect(reverse('education.school', args=(school_id, )))
def xls_student_to_arrangements(request, sid, cid, arrid): """ XLS导入学生账户 :param request: :param sid: :param cid: :param arrid: :return: """ wejudge_session = WeJudgeEducationSession(request) # 创建会话 response = WeJudgeResponse(wejudge_session) # 创建响应 manager = libs.EducationCourseController(request, response, sid) manager.get_course(cid) result = manager.xls_student_to_arrangements(arrid) return response.json(WeJudgeResult(msg=result))
def api_toggle_repository_to_course(request, sid, cid): """ 向课程添加/删除教学资源库关联 :param request: :param cid: course id :param sid: :return: """ wejudge_session = WeJudgeEducationSession(request) # 创建会话 response = WeJudgeResponse(wejudge_session) # 创建响应 manager = libs.EducationCourseController(request, response, sid) manager.get_course(cid) result = manager.toggle_repository_to_course() return response.json(WeJudgeResult(result))
def save_course_settings(request, sid, cid): """ 保存课程设置信息 :param request: :param cid: course id :param sid: :return: """ wejudge_session = WeJudgeEducationSession(request) # 创建会话 response = WeJudgeResponse(wejudge_session) # 创建响应 manager = libs.EducationCourseController(request, response, sid) manager.get_course(cid) result = manager.save_course_info() return response.json(WeJudgeResult(result))
def api_toggle_student_to_arrangements(request, sid, cid): """ 向排课添加/删除学生 :param request: :param cid: course id :param sid: :return: """ wejudge_session = WeJudgeEducationSession(request) # 创建会话 response = WeJudgeResponse(wejudge_session) # 创建响应 manager = libs.EducationCourseController(request, response, sid) manager.get_course(cid) result = manager.toggle_student_to_arrangements() return response.json(WeJudgeResult(result))
def api_get_course_arrangements(request, sid, cid): """ 当前课程的排课信息列表 :param request: :param cid: course id :param sid: :return: """ wejudge_session = WeJudgeEducationSession(request) # 创建会话 response = WeJudgeResponse(wejudge_session) # 创建响应 manager = libs.EducationCourseController(request, response, sid) manager.get_course(cid) result = manager.get_arrangements_list() return response.json(WeJudgeResult(result))