Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions exam/urls/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from exam.views.statistics import GetNowCourseExamAPI
from exam.views.statistics import GetLastCourseExamAPI
from exam.views.statistics import GetAllProblemAPI
from exam.views.admin import GetExamProblemAPI
from exam.views.admin import GetExamByIdAPI

urlpatterns = [
url(r"get-allcontent/?$", GetAllContentAPI.as_view(), name="get-allcontent"),
Expand All @@ -26,4 +28,6 @@
url(r"get-nowexam/?$",GetNowCourseExamAPI.as_view(), name="get-nowexam"),
url(r"get-lastexam/?$",GetLastCourseExamAPI.as_view(), name="get-lastexam"),
url(r"get-allproblem/?$", GetAllProblemAPI.as_view(), name="get-allproblem"),
url(r"get-examproblem/?$", GetExamProblemAPI.as_view(), name="get-examproblem"),
url(r"get-exambyid/?$", GetExamByIdAPI.as_view(), name="get-exambyid"),
]
24 changes: 24 additions & 0 deletions exam/views/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,27 @@ def post(self, request):
except Exception as e:
# not found
return self.error(msg=str(e), err=e.args)


class GetExamProblemAPI(APIview):
response_class = JSONResponse
def get(self, request):

exam_id=request.GET.get('exam_id')
type=request.GET.get('type')
try:
problem_list = ExamProblem.objects.get(exam_id =exam_id,type = type )
return self.success(problem_list)
except Exception as e:
return self.error(msg=str(e), err=e.args)

class GetExamByIdAP(APIview):
response_class = JSONResponse
def get(self, request):

exam_id=request.GET.get('exam_id')
try:
exam = Exam.objects.get(exam_id =exam_id)
return self.success(exam)
except Exception as e:
return self.error(msg=str(e), err=e.args)
1 change: 1 addition & 0 deletions oj/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@
url(r"^teacher/submission/statistics/",
include("submission.urls.statistics")),
url(r"^distribution/", include("submission.urls.statistics")),
url(r"^teacher/exam/", include("exam.urls.admin")),
]