Skip to content

Commit

Permalink
cotuongpc1: update ranking logic
Browse files Browse the repository at this point in the history
  • Loading branch information
quyettvq committed Aug 20, 2024
1 parent c29b4ad commit 3a546a1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
27 changes: 17 additions & 10 deletions src/cotuongpc1/ranking-table/RankingTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ export let RankingTable = ({players, matches, matchesById, matchSchedules, curre

let {firstPlayerGameScore, secondPlayerGameScore} = getGameScore(match);
let matchId = createMatchId(firstPlayerId, secondPlayerId);
let {roundIndex} = matchSchedules[matchId];
let matchSchedule = matchSchedules[matchId];
if (matchSchedule === undefined) {
continue;
}
let {roundIndex} = matchSchedule;
if (!isRoundReadyForRanking(roundIndex, currentRoundIndex)) {
continue;
}
Expand Down Expand Up @@ -118,15 +122,18 @@ export let RankingTable = ({players, matches, matchesById, matchSchedules, curre

// Who won the match between them?
let matchId = createMatchId(player1.id, player2.id);
let {roundIndex} = matchSchedules[matchId];
if (isRoundReadyForRanking(roundIndex, currentRoundIndex)) {
let matchOrEmpty = matchesById[matchId];
let matchResult = getMatchResult(matchOrEmpty);
if (matchResult === 2) {
return p1__p2;
}
if (matchResult === 0) {
return p2__p1;
let matchSchedule = matchSchedules[matchId];
if (matchSchedule !== undefined) {
let {roundIndex} = matchSchedule;
if (isRoundReadyForRanking(roundIndex, currentRoundIndex)) {
let matchOrEmpty = matchesById[matchId];
let matchResult = getMatchResult(matchOrEmpty);
if (matchResult === 2) {
return p1__p2;
}
if (matchResult === 0) {
return p2__p1;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/cotuongpc1/rounds-and-matches/RoundsAndMatches.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}

tr.recent-match {
background: aliceblue;
background: whitesmoke;
}

.match-info {
Expand Down

0 comments on commit 3a546a1

Please sign in to comment.