From 28f1de378d2d3ec07a8c8a5f36eb9c345116ac4c Mon Sep 17 00:00:00 2001 From: Michal Masrna Date: Sun, 24 Nov 2024 11:57:34 +0100 Subject: [PATCH] SemesterAdmin removed semester freezing. Semester freezes automatically when all series are frozen. --- .../SemesterAdministration.tsx | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/components/SemesterAdministration/SemesterAdministration.tsx b/src/components/SemesterAdministration/SemesterAdministration.tsx index 111b947e..1ffcf78d 100644 --- a/src/components/SemesterAdministration/SemesterAdministration.tsx +++ b/src/components/SemesterAdministration/SemesterAdministration.tsx @@ -88,22 +88,8 @@ export const SemesterAdministration: FC = () => { ) } - const [semesterFreezeError, setSemesterFreezeError] = useState() const [seriesFreezeErrors, setSeriesFreezeErrors] = useState>() - const {mutate: freezeSemester} = useMutation({ - mutationFn: (semester: SemesterWithProblems) => - axios.post(`/api/competition/semester/${semester.id}/results/freeze`), - onSuccess: () => refetch(), - onError: (error: unknown) => { - if (error instanceof AxiosError) { - setSemesterFreezeError(error.response?.data.detail) - } else { - setSemesterFreezeError('Nastala neznáma chyba.') - } - }, - }) - const {mutate: freezeSeries} = useMutation({ mutationFn: (series: SeriesWithProblems) => axios.post(`/api/competition/series/${series.id}/results/freeze`), onSuccess: () => refetch(), @@ -135,14 +121,7 @@ export const SemesterAdministration: FC = () => { <> Semester - {semester.complete ? ( - Semester je uzavretý - ) : ( - - )} - {semesterFreezeError && {semesterFreezeError}} + {semester.complete && Semester je uzavretý} {semester.series_set.map((series) => (