fix(dota.py): 当接口没有返回 party size 的时候通过数据库中的 Friend 数据进行比对

当接口没有返回 party size 的时候通过数据库中的 Friend 数据进行比对

Signed-off-by: Ching <loooching@gmail.com>
This commit is contained in:
Ching 2023-12-27 16:46:53 +08:00
parent 61566c20e1
commit fa6bef2c73

View File

@ -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