[web] Sort scoreboard
This commit is contained in:
parent
149037cf7d
commit
83b5d75ed1
@ -14,7 +14,8 @@ export const load = (async () => {
|
||||
problems: contest.problems.map((problem) => {
|
||||
return { id: problem.id, friendlyName: problem.friendlyName };
|
||||
}),
|
||||
teams: contest.teams.map((team) => {
|
||||
teams: contest.teams
|
||||
.map((team) => {
|
||||
return {
|
||||
name: team.name,
|
||||
solves: team.submissions.filter((submission) => {
|
||||
@ -60,7 +61,9 @@ export const load = (async () => {
|
||||
);
|
||||
})
|
||||
? team.submissions.find((submission) => {
|
||||
return submission.problemId === problem.id && submission.state === 'Correct';
|
||||
return (
|
||||
submission.problemId === problem.id && submission.state === 'Correct'
|
||||
);
|
||||
})
|
||||
? 'correct'
|
||||
: 'incorrect'
|
||||
@ -83,6 +86,21 @@ export const load = (async () => {
|
||||
})
|
||||
};
|
||||
})
|
||||
.sort((a, b) => {
|
||||
if (a.solves > b.solves) {
|
||||
return -1;
|
||||
} else if (a.solves < b.solves) {
|
||||
return 1;
|
||||
} else {
|
||||
if (a.time < b.time) {
|
||||
return -1;
|
||||
} else if (a.time > b.time) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
})
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user