feat: implement table assignment and distribution for tournament matches
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 44s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 44s
This commit is contained in:
@@ -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 ->
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user