From 92c561ccf7a8530ac7fc5d03696791d554f7a6eb Mon Sep 17 00:00:00 2001 From: kovacspe Date: Sat, 14 Dec 2024 22:29:59 +0100 Subject: [PATCH 1/3] =?UTF-8?q?TRansformovan=C3=BD=20zoznam=20=C3=BAloh=20?= =?UTF-8?q?na=20tabulku?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SemesterAdministration.tsx | 25 +++++++++++++------ src/types/api/generated/competition.ts | 2 ++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/components/SemesterAdministration/SemesterAdministration.tsx b/src/components/SemesterAdministration/SemesterAdministration.tsx index 43cf2b05..bffacf31 100644 --- a/src/components/SemesterAdministration/SemesterAdministration.tsx +++ b/src/components/SemesterAdministration/SemesterAdministration.tsx @@ -1,7 +1,8 @@ import {Stack, Typography} from '@mui/material' +import Grid from '@mui/material/Unstable_Grid2' import {useMutation, useQuery} from '@tanstack/react-query' import axios, {AxiosError} from 'axios' -import {FC, useState} from 'react' +import {FC, Fragment, useState} from 'react' import {Button} from '@/components/Clickable/Button' import {Link} from '@/components/Clickable/Link' @@ -149,13 +150,21 @@ export const SemesterAdministration: FC = () => { Termín série: {formatDateTime(series.deadline)} - - {series?.problems.map((problem) => ( - - {problem.order}. úloha - - ))} - + + {series?.problems.map((problem) => { + return ( + + + + {problem.order}. úloha + + + (0/0) + x + + ) + })} + ))} diff --git a/src/types/api/generated/competition.ts b/src/types/api/generated/competition.ts index 78610e60..2d1eb8d7 100644 --- a/src/types/api/generated/competition.ts +++ b/src/types/api/generated/competition.ts @@ -66,6 +66,8 @@ export interface ProblemCorrection { export interface Problem { id: number submitted?: any + num_solutions: number + num_corrected_solutions: number text: string order: number image?: any | null From 351bd93b8564d59455f405bb2e85e929fcce901f Mon Sep 17 00:00:00 2001 From: kovacspe Date: Sun, 15 Dec 2024 12:16:27 +0100 Subject: [PATCH 2/3] =?UTF-8?q?Pridan=C3=BD=20preh=C4=BEad=20opravenia=20s?= =?UTF-8?q?=C3=A9rie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SemesterAdministration.tsx | 25 ++++++++++++++++--- src/types/api/generated/competition.ts | 1 + 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/components/SemesterAdministration/SemesterAdministration.tsx b/src/components/SemesterAdministration/SemesterAdministration.tsx index bffacf31..bc75d182 100644 --- a/src/components/SemesterAdministration/SemesterAdministration.tsx +++ b/src/components/SemesterAdministration/SemesterAdministration.tsx @@ -11,6 +11,7 @@ import {formatDateTime} from '@/utils/formatDate' import {useDataFromURL} from '@/utils/useDataFromURL' import {useHasPermissions} from '@/utils/useHasPermissions' +import {ProblemEdit} from '../Admin/resources/competition/problems/ProblemEdit' import {Loading} from '../Loading/Loading' import {PublicationUploader} from '../PublicationUploader/PublicationUploader' import {Result} from '../Results/ResultsRow' @@ -150,17 +151,33 @@ export const SemesterAdministration: FC = () => { Termín série: {formatDateTime(series.deadline)} - + {series?.problems.map((problem) => { return ( - + {problem.order}. úloha - (0/0) - x + + {problem.num_corrected_solutions === problem.num_solutions ? ( + <>{`Opravené (${problem.num_solutions})`} + ) : ( + <> + {problem.num_corrected_solutions}/{problem.num_solutions} + + )} + + + {problem.solution_pdf ? ( + + Vzorák + + ) : ( + <>{'chýba vzorák'} + )} + ) })} diff --git a/src/types/api/generated/competition.ts b/src/types/api/generated/competition.ts index 2d1eb8d7..b354aecc 100644 --- a/src/types/api/generated/competition.ts +++ b/src/types/api/generated/competition.ts @@ -72,6 +72,7 @@ export interface Problem { order: number image?: any | null series?: any + solution_pdf?: string } export interface Comment { From 7f0d00a1e5051a045320e554456514ef07a5c031 Mon Sep 17 00:00:00 2001 From: matushl Date: Sun, 15 Dec 2024 12:29:37 +0100 Subject: [PATCH 3/3] Polish some code style --- .../SemesterAdministration.tsx | 55 +++++++++---------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/src/components/SemesterAdministration/SemesterAdministration.tsx b/src/components/SemesterAdministration/SemesterAdministration.tsx index bc75d182..6018e455 100644 --- a/src/components/SemesterAdministration/SemesterAdministration.tsx +++ b/src/components/SemesterAdministration/SemesterAdministration.tsx @@ -11,7 +11,6 @@ import {formatDateTime} from '@/utils/formatDate' import {useDataFromURL} from '@/utils/useDataFromURL' import {useHasPermissions} from '@/utils/useHasPermissions' -import {ProblemEdit} from '../Admin/resources/competition/problems/ProblemEdit' import {Loading} from '../Loading/Loading' import {PublicationUploader} from '../PublicationUploader/PublicationUploader' import {Result} from '../Results/ResultsRow' @@ -152,35 +151,33 @@ export const SemesterAdministration: FC = () => { - {series?.problems.map((problem) => { - return ( - - - - {problem.order}. úloha + {series?.problems.map((problem) => ( + + + + {problem.order}. úloha + + + + {problem.num_corrected_solutions === problem.num_solutions ? ( + <>{`Opravené (${problem.num_solutions})`} + ) : ( + <> + {problem.num_corrected_solutions}/{problem.num_solutions} + + )} + + + {problem.solution_pdf ? ( + + Vzorák - - - {problem.num_corrected_solutions === problem.num_solutions ? ( - <>{`Opravené (${problem.num_solutions})`} - ) : ( - <> - {problem.num_corrected_solutions}/{problem.num_solutions} - - )} - - - {problem.solution_pdf ? ( - - Vzorák - - ) : ( - <>{'chýba vzorák'} - )} - - - ) - })} + ) : ( + <>{'chýba vzorák'} + )} + + + ))} ))}