fix: 修复 openapi 接口报错时,战绩消息为空的问题
Some checks failed
continuous-integration/drone/tag Build is failing

This commit is contained in:
Ching 2024-05-12 01:10:47 +08:00
parent adcf1478d5
commit b61872f298

View File

@ -124,7 +124,12 @@ class Friend(BaseModel):
if limit > 10:
limit = 10
for friend in friends:
matches.extend(friend.serialize_recent_matches(limit=limit))
matches_ = friend.serialize_recent_matches(limit=limit)
if not matches_:
continue
matches.extend(matches_)
if not matches:
return None
# sort matches by start_time from latest to oldest
matches.sort(key=lambda x: x['start_time'], reverse=True)
name = friends[0].name