diff --git a/react-ui/src/pages/analyzeVotes/AnalyzeVotes.jsx b/react-ui/src/pages/analyzeVotes/AnalyzeVotes.jsx index 7edf574..415b298 100644 --- a/react-ui/src/pages/analyzeVotes/AnalyzeVotes.jsx +++ b/react-ui/src/pages/analyzeVotes/AnalyzeVotes.jsx @@ -84,7 +84,7 @@ function AnalyzeVotes() { const contestId = useContestId(); const { data: contests } = useSwrContests(); const contest = useMemo( - () => contests.find((c) => c.id === contestId) || contests[0], + () => contests.find((c) => c.id === contestId), [contests, contestId], ); const navigate = useNavigate(); @@ -100,6 +100,10 @@ function AnalyzeVotes() { const [user1, setUser1] = useState(''); const [user2, setUser2] = useState(''); + if (!contestId && contests[0]?.id) { + navigate(`/mod/analyze/${contests[0].id}`, { replace: true }); + } + const numberOfEntries = Object.keys(entryAvg).length; const usernames = useMemo(() => userAvg.map((ua) => ua.username), [userAvg]); const formattedContest = (name, date) => `${name} (${format(parseISO(date), 'MMM yy')})`;