From 42b000fe894e1329050cb476fc53d31662264c29 Mon Sep 17 00:00:00 2001 From: Ching Date: Mon, 18 Sep 2023 18:12:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(dota.py):=20=E4=BF=AE=E5=A4=8D=20party=5Fsi?= =?UTF-8?q?ze=20=E4=B8=BA=20None=20=E5=AF=BC=E8=87=B4=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8C=96=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 party_size 为 None 导致序列化报错的问题 Signed-off-by: Ching --- dota.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dota.py b/dota.py index b55b4e0..5d48887 100644 --- a/dota.py +++ b/dota.py @@ -130,8 +130,10 @@ class Friend(BaseModel): } for match_ in matches[:limit]: duration = '%d:%02d:%02d' % utils.convert_seconds_to_hms(match_['duration']) - if match_['party_size'] > 1: + if match_['party_size'] and match_['party_size'] > 1: summary = f"{match_['party_size']}黑 {duration}" + elif match_['party_size'] == None: + summary = f"??黑 {duration}" else: summary = f"单排 {duration}"