1
0

Optimize Create Fight

Dieser Commit ist enthalten in:
Chaoscaot 2023-04-12 00:14:38 +02:00
Ursprung f1f3c5f610
Commit 346a3b9a46

Datei anzeigen

@ -168,7 +168,7 @@ class GroupBracketGenerator extends HookConsumerWidget {
final repo = await ref.read(eventRepositoryProvider.future); final repo = await ref.read(eventRepositoryProvider.future);
for (final group in fights) { for (final group in fights) {
for (final round in group) { for (final round in group) {
for (final fight in round) { await Future.wait(round.map((fight) {
final blue = getTeam(fight[0]); final blue = getTeam(fight[0]);
final red = getTeam(fight[1]); final red = getTeam(fight[1]);
final start = startTime.value.add( final start = startTime.value.add(
@ -177,7 +177,7 @@ class GroupBracketGenerator extends HookConsumerWidget {
(round.indexOf(fight) + (round.indexOf(fight) +
(fights.indexOf(group) * round.length)), (fights.indexOf(group) * round.length)),
); );
await repo.createFight( return repo.createFight(
event.event.id, event.event.id,
start, start,
gamemode.value!, gamemode.value!,
@ -186,10 +186,9 @@ class GroupBracketGenerator extends HookConsumerWidget {
red, red,
0, 0,
"Gruppe ${fights.indexOf(group) + 1}"); "Gruppe ${fights.indexOf(group) + 1}");
} }));
} }
} }
context.go("/events/${event.event.id}");
} }
: null, : null,
label: const Text("Generate")), label: const Text("Generate")),