fix
This commit is contained in:
@@ -479,7 +479,7 @@ class UserProblemRankAPI(APIView):
|
||||
if not user.is_authenticated:
|
||||
return self.error("User is not authenticated")
|
||||
|
||||
problem = Problem.objects.get(_id=problem_id, contest_id__isnull=True, visible=True)
|
||||
problem = Problem.objects.get(_id__iexact=problem_id, contest_id__isnull=True, visible=True)
|
||||
submissions = Submission.objects.filter(problem=problem, result=JudgeStatus.ACCEPTED)
|
||||
|
||||
all_ac_count = submissions.values("user_id").distinct().count()
|
||||
|
||||
@@ -13,7 +13,7 @@ class CommentAPI(APIView):
|
||||
if problem_id:
|
||||
try:
|
||||
# 这里如果题目不可见,也需要显示该题目的评论
|
||||
problem = Problem.objects.get(_id=problem_id, contest_id__isnull=True)
|
||||
problem = Problem.objects.get(_id__iexact=problem_id, contest_id__isnull=True)
|
||||
except Problem.DoesNotExist:
|
||||
return self.error("Problem doesn't exist")
|
||||
comments = comments.filter(problem=problem)
|
||||
|
||||
@@ -75,7 +75,7 @@ class FlowchartSubmissionListAPI(APIView):
|
||||
if problem_id:
|
||||
try:
|
||||
problem = Problem.objects.get(
|
||||
_id=problem_id, contest_id__isnull=True, visible=True
|
||||
_id__iexact=problem_id, contest_id__isnull=True, visible=True
|
||||
)
|
||||
except Problem.DoesNotExist:
|
||||
return self.error("Problem doesn't exist")
|
||||
|
||||
@@ -70,7 +70,7 @@ class ProblemAPI(APIView):
|
||||
if problem_id:
|
||||
try:
|
||||
problem = Problem.objects.select_related("created_by").get(
|
||||
_id=problem_id, contest_id__isnull=True, visible=True
|
||||
_id__iexact=problem_id, contest_id__isnull=True, visible=True
|
||||
)
|
||||
problem_data = ProblemSerializer(problem).data
|
||||
self._add_problem_status(request, problem_data)
|
||||
@@ -160,7 +160,7 @@ class ContestProblemAPI(APIView):
|
||||
if problem_id:
|
||||
try:
|
||||
problem = Problem.objects.select_related("created_by").get(
|
||||
_id=problem_id, contest=self.contest, visible=True
|
||||
_id__iexact=problem_id, contest=self.contest, visible=True
|
||||
)
|
||||
except Problem.DoesNotExist:
|
||||
return self.error("Problem does not exist.")
|
||||
@@ -224,7 +224,7 @@ class SimilarProblemAPI(APIView):
|
||||
return self.error("problem_id is required")
|
||||
|
||||
try:
|
||||
problem = Problem.objects.get(_id=problem_display_id, contest__isnull=True)
|
||||
problem = Problem.objects.get(_id__iexact=problem_display_id, contest__isnull=True)
|
||||
except Problem.DoesNotExist:
|
||||
return self.error("Problem not found")
|
||||
|
||||
@@ -295,7 +295,7 @@ class ProblemYearlyACRateAPI(APIView):
|
||||
|
||||
try:
|
||||
problem = Problem.objects.get(
|
||||
_id=problem_id, contest_id__isnull=True, visible=True
|
||||
_id__iexact=problem_id, contest_id__isnull=True, visible=True
|
||||
)
|
||||
except Problem.DoesNotExist:
|
||||
return self.error("Problem does not exist")
|
||||
|
||||
@@ -141,7 +141,7 @@ class ProblemSetProblemAdminAPI(APIView):
|
||||
data = request.data
|
||||
try:
|
||||
problem = Problem.objects.filter(
|
||||
_id=data["problem_id"],
|
||||
_id__iexact=data["problem_id"],
|
||||
visible=True,
|
||||
contest_id__isnull=True,
|
||||
).get()
|
||||
|
||||
@@ -52,7 +52,7 @@ class SubmissionStatisticsAPI(APIView):
|
||||
if problem_id:
|
||||
try:
|
||||
problem = Problem.objects.get(
|
||||
_id=problem_id, contest_id__isnull=True, visible=True
|
||||
_id__iexact=problem_id, contest_id__isnull=True, visible=True
|
||||
)
|
||||
except Problem.DoesNotExist:
|
||||
return self.error("Problem doesn't exist")
|
||||
|
||||
@@ -172,7 +172,7 @@ class SubmissionListAPI(APIView):
|
||||
if problem_id:
|
||||
try:
|
||||
problem = Problem.objects.get(
|
||||
_id=problem_id, contest_id__isnull=True, visible=True
|
||||
_id__iexact=problem_id, contest_id__isnull=True, visible=True
|
||||
)
|
||||
except Problem.DoesNotExist:
|
||||
return self.error("Problem doesn't exist")
|
||||
@@ -225,7 +225,7 @@ class ContestSubmissionListAPI(APIView):
|
||||
if problem_id:
|
||||
try:
|
||||
problem = Problem.objects.get(
|
||||
_id=problem_id, contest_id=contest.id, visible=True
|
||||
_id__iexact=problem_id, contest_id=contest.id, visible=True
|
||||
)
|
||||
except Problem.DoesNotExist:
|
||||
return self.error("Problem doesn't exist")
|
||||
|
||||
Reference in New Issue
Block a user