From 07bf2e2fe7c73f6cc663bdf4a1da13c3e0703bce Mon Sep 17 00:00:00 2001 From: Harry-zklcdc <1269158832@qq.com> Date: Sun, 2 Aug 2020 15:20:32 +0800 Subject: [PATCH] [Fix] Contest Rank User's Title --- contest/views/oj.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contest/views/oj.py b/contest/views/oj.py index 4264fcba..85b2f301 100644 --- a/contest/views/oj.py +++ b/contest/views/oj.py @@ -192,6 +192,6 @@ class ContestRankAPI(APIView): page_qs["results"] = serializer(page_qs["results"], many=True, is_contest_admin=is_contest_admin).data for i in range(0, len(page_qs["results"])): user = User.objects.get(username=page_qs["results"][i]["user"]["username"], is_disabled=False) - grade = UserProfileSerializer(user.userprofile, show_real_name=True).data["grade"] - page_qs["results"][i]["user"].update({"grade": grade}) + userprofile = UserProfileSerializer(user.userprofile, show_real_name=True).data + page_qs["results"][i].update({"grade": userprofile["grade"], "title": userprofile["user"]["title"], "title_color": userprofile["user"]["title_color"]}) return self.success(page_qs)