From ae177107b2b4aba453581d6f37df2dad47a4ddbe Mon Sep 17 00:00:00 2001 From: Ching Date: Wed, 27 Dec 2023 16:46:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(dota.py):=20=E5=BD=93=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=BF=94=E5=9B=9E=20party=20size=20=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E9=80=9A=E8=BF=87=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=20Friend=20=E6=95=B0=E6=8D=AE=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E6=AF=94=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当接口没有返回 party size 的时候通过数据库中的 Friend 数据进行比对 Signed-off-by: Ching --- dota.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dota.py b/dota.py index 8c4d5ed..cacfef2 100644 --- a/dota.py +++ b/dota.py @@ -66,6 +66,9 @@ class Match(BaseModel): 'party_size': self.party_size, 'match_id': self.match_id, } + if not self.party_size: + player_account_ids = [player.account_id for player in match_.players if player.account_id] + match_data['party_size'] = Friend.select().where(Friend.steam_id.in_(player_account_ids)).count() return match_data