Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
inker committed Jul 6, 2024
1 parent 70a0a2b commit ba18179
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/containers/LeagueStage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ function LeagueStage({ season, pots: initialPots }: Props) {
() => [],
),
);
const [isFixturesDone, setIsFixturesDone] = useState(false);

const abortSignal = useAbortSignal();

Expand Down Expand Up @@ -91,24 +90,24 @@ function LeagueStage({ season, pots: initialPots }: Props) {
for await (const pickedMatch of generator) {
setPairings(prev => [...prev, pickedMatch]);
}
setIsFixturesDone(true);
};

formPairings();
}, []);

const isFixturesDone = pairings.length === numMatches;

useEffect(() => {
if (isFixturesDone) {
const formSchedule = async () => {
// setIsMatchdayMode(true);
// setSchedule(chunk(pairings, 18));
const it = await generateSchedule({
matchdaySize,
allGames: pairings,
currentSchedule: schedule,
signal: abortSignal,
});
setSchedule(it.solutionSchedule.map(md => shuffle(md)));
const newSchedule = it.solutionSchedule.map(md => shuffle(md));
setSchedule(newSchedule);
setIsMatchdayMode(true);
};

Expand Down

0 comments on commit ba18179

Please sign in to comment.