Switch to backend positioning

This commit is contained in:
Daniel Schädler 2024-04-07 22:11:34 +02:00
parent 8dae8b0996
commit 6d136d65d7
2 changed files with 11 additions and 13 deletions

View File

@ -79,10 +79,11 @@ function GroupScoresTable(props) {
return (<Table className='mt-4' striped size='sm' responsive>
<thead>
<tr>
<th>Position</th>
<th>Team</th>
<th><span title="Punkte">Pkt.</span></th>
<th><span title="Becherdifferenz">Dif.</span></th>
<th><span title="Getroffene Becher (Geworfen)">Gew.</span></th>
<th><span title="Erhaltene Becher (Kassiert)">Kas.</span></th>
</tr>
</thead>
<tbody>
@ -94,9 +95,10 @@ function GroupScoresTable(props) {
function GroupScoresTableRow(props) {
return (<tr>
<td>{props.score.position}</td>
<td>{props.score.team.name}</td>
<td>{props.score.group_points}</td>
<td>{props.score.difference_in_points}</td>
<td>{props.score.scored_points}</td>
<td>{props.score.received_points}</td>
</tr>);
}

View File

@ -34,7 +34,7 @@ export function getTournamentMeta(tournamentId, successCallback, errorCallback)
.catch(errorCallback);
}
export function getTournamentMatches(tournamentId, successCallback, errorCallback, matchState=null) {
export function getTournamentMatches(tournamentId, successCallback, errorCallback, matchState = null) {
let matchFilter = '';
if (matchState) {
matchFilter = '?state=' + matchState;
@ -88,16 +88,12 @@ function convertGroup(apiGroup) {
id: apiGroup.id,
number: apiGroup.number,
scores: apiGroup.group_scores.sort((a, b) => {
if (a.group_points > b.group_points) { return -1 }
else if(a.group_points < b.group_points) { return 1 }
else {
if (a.difference_in_points > b.difference_in_points) { return -1 }
else if (a.difference_in_points < b.difference_in_points) { return 1 }
else {
if (a.scored_points > b.scored_points) { return -1 }
else if (a.scored_points < b.scored_points) { return 1 }
else { return 0 }
}
if (a.position > b.position) {
return 1;
} else if (a.position < b.position) {
return -1;
} else {
return 0;
}
}),
matches: apiGroup.matches.sort((a, b) => a.position > b.position).map(match => convertMatch(match, true))