fix: 修复战报中开黑数据返回格式有误的问题
This commit is contained in:
parent
eddfcbf7f7
commit
3087dd3085
13
dota.py
13
dota.py
@ -139,11 +139,15 @@ class Friend(BaseModel):
|
|||||||
}
|
}
|
||||||
for match_ in matches[:limit]:
|
for match_ in matches[:limit]:
|
||||||
duration = '%d:%02d:%02d' % utils.convert_seconds_to_hms(match_['duration'])
|
duration = '%d:%02d:%02d' % utils.convert_seconds_to_hms(match_['duration'])
|
||||||
|
if match_['party_size'] == None:
|
||||||
|
if Match.filter(match_id=match_['match_id']).exists():
|
||||||
|
match_['party_size'] = Match.get(match_id=match_['match_id']).party_size
|
||||||
|
else:
|
||||||
|
match_['party_size'] = 0
|
||||||
|
summary = f"{duration}"
|
||||||
if match_['party_size'] and match_['party_size'] > 1:
|
if match_['party_size'] and match_['party_size'] > 1:
|
||||||
summary = f"{match_['party_size']}黑 {duration}"
|
summary = f"{match_['party_size']}黑 {duration}"
|
||||||
elif match_['party_size'] == None:
|
elif match_['party_size'] and match_['party_size'] == 1:
|
||||||
summary = f"??黑 {duration}"
|
|
||||||
else:
|
|
||||||
summary = f"单排 {duration}"
|
summary = f"单排 {duration}"
|
||||||
|
|
||||||
if match_['average_rank']:
|
if match_['average_rank']:
|
||||||
@ -228,10 +232,11 @@ def serialize_match_for_discord(match_):
|
|||||||
if Match.filter(match_id=match_['match_id']).exists():
|
if Match.filter(match_id=match_['match_id']).exists():
|
||||||
match_['party_size'] = Match.get(match_id=match_['match_id']).party_size
|
match_['party_size'] = Match.get(match_id=match_['match_id']).party_size
|
||||||
else:
|
else:
|
||||||
|
match_['party_size'] = 0
|
||||||
summary = f"{match_['duration']}"
|
summary = f"{match_['duration']}"
|
||||||
if match_['party_size'] > 1:
|
if match_['party_size'] > 1:
|
||||||
summary = f"{match_['party_size']}黑 {match_['duration']}"
|
summary = f"{match_['party_size']}黑 {match_['duration']}"
|
||||||
else:
|
elif match_['party_size'] == 1:
|
||||||
summary = f"单排 {match_['duration']}"
|
summary = f"单排 {match_['duration']}"
|
||||||
|
|
||||||
radiant = []
|
radiant = []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user