fix
This commit is contained in:
@@ -479,7 +479,7 @@ class UserProblemRankAPI(APIView):
|
|||||||
if not user.is_authenticated:
|
if not user.is_authenticated:
|
||||||
return self.error("User is not 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)
|
submissions = Submission.objects.filter(problem=problem, result=JudgeStatus.ACCEPTED)
|
||||||
|
|
||||||
all_ac_count = submissions.values("user_id").distinct().count()
|
all_ac_count = submissions.values("user_id").distinct().count()
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class CommentAPI(APIView):
|
|||||||
if problem_id:
|
if problem_id:
|
||||||
try:
|
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:
|
except Problem.DoesNotExist:
|
||||||
return self.error("Problem doesn't exist")
|
return self.error("Problem doesn't exist")
|
||||||
comments = comments.filter(problem=problem)
|
comments = comments.filter(problem=problem)
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class FlowchartSubmissionListAPI(APIView):
|
|||||||
if problem_id:
|
if problem_id:
|
||||||
try:
|
try:
|
||||||
problem = Problem.objects.get(
|
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:
|
except Problem.DoesNotExist:
|
||||||
return self.error("Problem doesn't exist")
|
return self.error("Problem doesn't exist")
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class ProblemAPI(APIView):
|
|||||||
if problem_id:
|
if problem_id:
|
||||||
try:
|
try:
|
||||||
problem = Problem.objects.select_related("created_by").get(
|
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
|
problem_data = ProblemSerializer(problem).data
|
||||||
self._add_problem_status(request, problem_data)
|
self._add_problem_status(request, problem_data)
|
||||||
@@ -160,7 +160,7 @@ class ContestProblemAPI(APIView):
|
|||||||
if problem_id:
|
if problem_id:
|
||||||
try:
|
try:
|
||||||
problem = Problem.objects.select_related("created_by").get(
|
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:
|
except Problem.DoesNotExist:
|
||||||
return self.error("Problem does not exist.")
|
return self.error("Problem does not exist.")
|
||||||
@@ -224,7 +224,7 @@ class SimilarProblemAPI(APIView):
|
|||||||
return self.error("problem_id is required")
|
return self.error("problem_id is required")
|
||||||
|
|
||||||
try:
|
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:
|
except Problem.DoesNotExist:
|
||||||
return self.error("Problem not found")
|
return self.error("Problem not found")
|
||||||
|
|
||||||
@@ -295,7 +295,7 @@ class ProblemYearlyACRateAPI(APIView):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
problem = Problem.objects.get(
|
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:
|
except Problem.DoesNotExist:
|
||||||
return self.error("Problem does not exist")
|
return self.error("Problem does not exist")
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ class ProblemSetProblemAdminAPI(APIView):
|
|||||||
data = request.data
|
data = request.data
|
||||||
try:
|
try:
|
||||||
problem = Problem.objects.filter(
|
problem = Problem.objects.filter(
|
||||||
_id=data["problem_id"],
|
_id__iexact=data["problem_id"],
|
||||||
visible=True,
|
visible=True,
|
||||||
contest_id__isnull=True,
|
contest_id__isnull=True,
|
||||||
).get()
|
).get()
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class SubmissionStatisticsAPI(APIView):
|
|||||||
if problem_id:
|
if problem_id:
|
||||||
try:
|
try:
|
||||||
problem = Problem.objects.get(
|
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:
|
except Problem.DoesNotExist:
|
||||||
return self.error("Problem doesn't exist")
|
return self.error("Problem doesn't exist")
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ class SubmissionListAPI(APIView):
|
|||||||
if problem_id:
|
if problem_id:
|
||||||
try:
|
try:
|
||||||
problem = Problem.objects.get(
|
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:
|
except Problem.DoesNotExist:
|
||||||
return self.error("Problem doesn't exist")
|
return self.error("Problem doesn't exist")
|
||||||
@@ -225,7 +225,7 @@ class ContestSubmissionListAPI(APIView):
|
|||||||
if problem_id:
|
if problem_id:
|
||||||
try:
|
try:
|
||||||
problem = Problem.objects.get(
|
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:
|
except Problem.DoesNotExist:
|
||||||
return self.error("Problem doesn't exist")
|
return self.error("Problem doesn't exist")
|
||||||
|
|||||||
Reference in New Issue
Block a user