Skip to content

Commit

Permalink
Analyze votes redirects to most recent content
Browse files Browse the repository at this point in the history
  • Loading branch information
rissois committed Sep 26, 2024
1 parent b6662bb commit b1f828f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion react-ui/src/pages/analyzeVotes/AnalyzeVotes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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')})`;
Expand Down

0 comments on commit b1f828f

Please sign in to comment.