Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pinecone28 committed Feb 17, 2022
1 parent 73180f3 commit b318679
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/problem/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class BaseProblemSerializer(serializers.ModelSerializer):
def get_contest_name(self, obj):
if obj.contest:
return obj.contest.title

def get_assignment_name(self, obj):
if obj.assignment:
return obj.assignment.title
Expand Down
1 change: 1 addition & 0 deletions backend/problem/views/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from django.http import StreamingHttpResponse

from contest.models import Contest, ContestStatus
from course.models import Course
from judge.dispatcher import SPJCompiler
from submission.models import Submission
from utils.api import APIView, CSRFExemptAPIView, validate_serializer, APIError
Expand Down
2 changes: 1 addition & 1 deletion backend/problem/views/professor.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def get(self, request):
@admin_role_required
def post(self, request):
data = request.data

try:
course = Course.objects.get(id=data.pop("course_id"))
ensure_created_by(course, request.user)
Expand Down
6 changes: 5 additions & 1 deletion backend/submission/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ def post(self, request):
return self.error(error)

try:
problem = Problem.objects.get(id=data["problem_id"], contest_id=data.get("contest_id"), assignment_id=data.get("assignment_id"), course_id=data.get("course_id"), visible=True)
problem = Problem.objects.get(id=data["problem_id"],
contest_id=data.get("contest_id"),
assignment_id=data.get("assignment_id"),
course_id=data.get("course_id"),
visible=True)
except Problem.DoesNotExist:
return self.error("Problem not exist")
if data["language"] not in problem.languages:
Expand Down

0 comments on commit b318679

Please sign in to comment.