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

View File

@ -88,16 +88,12 @@ function convertGroup(apiGroup) {
id: apiGroup.id, id: apiGroup.id,
number: apiGroup.number, number: apiGroup.number,
scores: apiGroup.group_scores.sort((a, b) => { scores: apiGroup.group_scores.sort((a, b) => {
if (a.group_points > b.group_points) { return -1 } if (a.position > b.position) {
else if(a.group_points < b.group_points) { return 1 } return 1;
else { } else if (a.position < b.position) {
if (a.difference_in_points > b.difference_in_points) { return -1 } return -1;
else if (a.difference_in_points < b.difference_in_points) { return 1 } } else {
else { return 0;
if (a.scored_points > b.scored_points) { return -1 }
else if (a.scored_points < b.scored_points) { return 1 }
else { return 0 }
}
} }
}), }),
matches: apiGroup.matches.sort((a, b) => a.position > b.position).map(match => convertMatch(match, true)) matches: apiGroup.matches.sort((a, b) => a.position > b.position).map(match => convertMatch(match, true))