diff --git a/problem/views/oj.py b/problem/views/oj.py index caf8a68..c4b7413 100644 --- a/problem/views/oj.py +++ b/problem/views/oj.py @@ -106,6 +106,11 @@ class ProblemAPI(APIView): if difficulty: problems = problems.filter(difficulty=difficulty) + # 排序 + sort = request.GET.get("sort") + if sort: + problems = problems.order_by(sort) + # 根据profile 为做过的题目添加标记 data = self.paginate_data(request, problems, ProblemListSerializer) self._add_problem_status(request, data)