Commit f91d0f06 authored by xiaoye's avatar xiaoye

Update match.ts

parent 6d18e1ab
Pipeline #40245 passed with stages
in 2 minutes and 27 seconds
......@@ -25,20 +25,16 @@ class Match {
this.round = obj.round;
this.isThirdPlaceMatch = obj.isThirdPlaceMatch;
this.status = obj.status;
const name1_str = p.find(i => i.id == obj.player1Id)?.name ?? '';
const name1 = name1_str.split(/[\+\uFF0B]/) ?? [];
this.player1 = {
id : obj.player1Id,
name : (name1.length == 2 && !Number.isNaN(name1[0]) && name1[0].length > 3) ? name1[1] : name1_str,
qq : (name1.length == 2 && !Number.isNaN(name1[0]) && name1[0].length > 3) ? name1[0] : undefined,
name : p.find(i => i.id == obj.player1Id)?.name ?? '',
qq : p.find(i => i.id == obj.player1Id)?.qq ?? undefined,
score : obj.player1Score
};
const name2_str = p.find(i => i.id == obj.player2Id)?.name ?? '';
const name2 = name2_str?.split(/[\+\uFF0B]/) ?? [];
this.player2 = {
id : obj.player2Id,
name : (name2.length == 2 && !Number.isNaN(name2[0]) && name2[0].length > 3) ? name2[1] : name2_str,
qq : (name2.length == 2 && !Number.isNaN(name2[0]) && name2[0].length > 3) ? name2[0] : undefined,
name : p.find(i => i.id == obj.player2Id)?.name ?? '',
qq : p.find(i => i.id == obj.player2Id)?.qq ?? undefined,
score : obj.player2Score
};
this.winnerId = obj.winnerId as number | null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment