working runner w/o spotify
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Button, TextInput, Stack, Group, Text, Flex, Divider } from "@mantine/core";
|
||||
import { Button, TextInput, Stack, Group, Text, Flex, Divider, NumberInput } from "@mantine/core";
|
||||
import { useForm } from "@mantine/form";
|
||||
import { Match } from "@/features/matches/types";
|
||||
|
||||
@@ -92,11 +92,10 @@ export const MatchForm: React.FC<MatchFormProps> = ({
|
||||
</Text>))
|
||||
}
|
||||
</Stack>
|
||||
<TextInput
|
||||
<NumberInput
|
||||
ml='auto'
|
||||
type="number"
|
||||
min={0}
|
||||
w={50}
|
||||
w={70}
|
||||
ta="center"
|
||||
key={form.key("home_cups")}
|
||||
{...form.getInputProps("home_cups")}
|
||||
@@ -116,11 +115,10 @@ export const MatchForm: React.FC<MatchFormProps> = ({
|
||||
</Text>))
|
||||
}
|
||||
</Stack>
|
||||
<TextInput
|
||||
<NumberInput
|
||||
ml='auto'
|
||||
ta="center"
|
||||
w={50}
|
||||
type="number"
|
||||
w={70}
|
||||
min={0}
|
||||
key={form.key("away_cups")}
|
||||
{...form.getInputProps("away_cups")}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/**
|
||||
* Imports saved json dumps of bracket generation from a python script that I didn't prioritize converting to TS
|
||||
*/
|
||||
import b10 from "../../../../brackets/10.json";
|
||||
import b11 from "../../../../brackets/11.json";
|
||||
import b12 from "../../../../brackets/12.json";
|
||||
import b13 from "../../../../brackets/13.json";
|
||||
import b14 from "../../../../brackets/14.json";
|
||||
@@ -12,6 +14,8 @@ import b19 from "../../../../brackets/19.json";
|
||||
import b20 from "../../../../brackets/20.json";
|
||||
|
||||
export default {
|
||||
10: b10,
|
||||
11: b11,
|
||||
12: b12,
|
||||
13: b13,
|
||||
14: b14,
|
||||
|
||||
@@ -184,6 +184,9 @@ export const endMatch = createServerFn()
|
||||
const matchLoser = home_cups < away_cups ? match.home : match.away;
|
||||
if (!matchWinner || !matchLoser) throw new Error("Something went wrong");
|
||||
|
||||
console.log(matchWinner)
|
||||
console.log(matchLoser)
|
||||
|
||||
// winner -> where to send match winner to, loser same
|
||||
const { winner, loser } = await pbAdmin.getChildMatches(matchId);
|
||||
|
||||
@@ -207,7 +210,7 @@ export const endMatch = createServerFn()
|
||||
// advance bracket
|
||||
if (winner) {
|
||||
await pbAdmin.updateMatch(winner.id, {
|
||||
[winner.home_from_lid === match.lid ? "home" : "away"]: matchWinner,
|
||||
[winner.home_from_lid === match.lid ? "home" : "away"]: matchWinner.id,
|
||||
status:
|
||||
(winner.home_from_lid === match.lid && winner.away) ||
|
||||
(winner.away_from_lid === match.lid && winner.home)
|
||||
@@ -218,7 +221,7 @@ export const endMatch = createServerFn()
|
||||
|
||||
if (loser) {
|
||||
await pbAdmin.updateMatch(loser.id, {
|
||||
[loser.home_from_lid === match.lid ? "home" : "away"]: matchLoser,
|
||||
[loser.home_from_lid === match.lid ? "home" : "away"]: matchLoser.id,
|
||||
status:
|
||||
(loser.home_from_lid === match.lid && loser.away) ||
|
||||
(loser.away_from_lid === match.lid && loser.home)
|
||||
|
||||
Reference in New Issue
Block a user