Commit 95ee7e93 authored by nanahira's avatar nanahira

Update src/tournament-rules/rules/swiss.ts, src/tournament/entities/Tournament.entity.ts files

parent bee7524b
Pipeline #37944 passed with stages
in 5 minutes and 42 seconds
...@@ -100,7 +100,7 @@ export class Swiss extends TournamentRuleBase { ...@@ -100,7 +100,7 @@ export class Swiss extends TournamentRuleBase {
const opponents = opponentIds.map((id) => this.participantMap.get(id)); const opponents = opponentIds.map((id) => this.participantMap.get(id));
return { return {
tieBreaker: _.sumBy(opponents, (p) => p.score.score), tieBreaker: _.sumBy(opponents, (p) => p.score.score),
score: participant.quit ? -1 : participant.score, ...(participant.quit ? { score: -1 } : {})
}; };
} }
} }
...@@ -249,7 +249,7 @@ export class Tournament extends DescBase { ...@@ -249,7 +249,7 @@ export class Tournament extends DescBase {
Object.assign(p.score, rule.participantScore(p)); Object.assign(p.score, rule.participantScore(p));
}); });
const editScores = this.participants.map((p) => rule.participantScoreAfter(p)); const editScores = this.participants.map((p) => rule.participantScoreAfter(p));
this.participants.forEach((p, i) => Object.assign(p, editScores[i])) this.participants.forEach((p, i) => Object.assign(p.score, editScores[i]))
this.participants = _.sortBy( this.participants = _.sortBy(
this.participants, this.participants,
(p) => -p.score.score, (p) => -p.score.score,
......
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