From 2738e4324bed73036992bdb0780ca9d3512aea20 Mon Sep 17 00:00:00 2001 From: fan9704 Date: Fri, 26 Jul 2024 00:27:35 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(views):=20Statistic=20top3?= =?UTF-8?q?=20team?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit from all team to top3 team https://github.com/sitcon-tw/Camp2024-Drawing-Competition-Backend/issues/48 --- api/views/statistic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/views/statistic.py b/api/views/statistic.py index 2347eb9..8622b11 100644 --- a/api/views/statistic.py +++ b/api/views/statistic.py @@ -195,7 +195,8 @@ def get(self, request, round_id: int): d["score_list"].append(0) d["total_score"] = total_score data.append(d) - + # 取得前三名資料 + data = sorted(data, key=lambda x: x["total_score"], reverse=True)[:3] return Response(data, status=status.HTTP_200_OK) except Round.DoesNotExist: return Response(