test contest

This commit is contained in:
2026-08-09 15:33:07 +08:00
parent ebd6070aae
commit ee006fba18
4 changed files with 356 additions and 8 deletions
+15 -1
View File
@@ -329,11 +329,25 @@
const score = document.createElement("p");
score.textContent =
`${match.attempt.score} 分 · ${match.opponent.score}${match.opponent.nickname}`;
const timeLine = document.createElement("p");
timeLine.className = "realtime-time-line";
const selfMs = match.attempt.duration_ms || 0;
const opponentMs = match.opponent.duration_ms || 0;
const selfSec = (selfMs / 1000).toFixed(1);
const opponentSec = (opponentMs / 1000).toFixed(1);
timeLine.textContent = `${selfSec}s · ${match.opponent.nickname} ${opponentSec}s`;
if (match.attempt.score === match.opponent.score && match.result.winner !== "draw") {
const faster = selfMs < opponentMs ? "你" : match.opponent.nickname;
const tiebreak = document.createElement("small");
tiebreak.className = "realtime-tiebreak";
tiebreak.textContent = `同分,${faster}更快完成,快者胜`;
timeLine.append(tiebreak);
}
const rating = document.createElement("b");
const sign = match.result.rating_delta > 0 ? "+" : "";
rating.textContent =
`Rating ${sign}${match.result.rating_delta}${match.result.rating_after}`;
result.append(outcome, score, rating);
result.append(outcome, score, timeLine, rating);
root.append(result);
const review = document.createElement("div");