feat: implement table assignment and distribution for tournament matches
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 44s

This commit is contained in:
Torsten Schulz (local)
2026-05-17 23:55:39 +02:00
parent 6c7ae6860b
commit 697e67d46e
16 changed files with 426 additions and 22 deletions

View File

@@ -135,8 +135,22 @@ internal fun TournamentEditorClassesTab(
)
}
Column(Modifier.fillMaxWidth()) {
Button(onClick = { showAdd = true }, modifier = Modifier.fillMaxWidth()) {
Text(tr("tournaments.addClass", "Klasse anlegen"))
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.fillMaxWidth()) {
Button(onClick = { showAdd = true }, modifier = Modifier.weight(1f)) {
Text(tr("tournaments.addClass", "Klasse anlegen"))
}
OutlinedButton(onClick = {
scope.launch {
runCatching {
withContext(Dispatchers.IO) {
api.distributeTables(de.tsschulz.tt_tagebuch.shared.api.models.TournamentClubTournamentBody(clubId, tournamentId))
}
}.onFailure { onError(it.message) }
onReload()
}
}, modifier = Modifier.weight(1f)) {
Text(tr("tournaments.distributeTables", "Freie Tische verteilen"))
}
}
Column(verticalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.padding(top = 12.dp)) {
classes.forEach { c ->

View File

@@ -156,6 +156,12 @@ class TournamentsApi(
}
}
suspend fun distributeTables(body: TournamentClubTournamentBody) {
client.http.post("/api/tournament/matches/distribute") {
setBody(body)
}
}
suspend fun getGroups(clubId: Int, tournamentId: Int): JsonElement {
return client.http.get("/api/tournament/groups") {
parameter("clubId", clubId)