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)