diff --git a/src/components/SemesterAdministration/SemesterAdministration.module.scss b/src/components/SemesterAdministration/SemesterAdministration.module.scss index 66f7f244..0ce1106f 100644 --- a/src/components/SemesterAdministration/SemesterAdministration.module.scss +++ b/src/components/SemesterAdministration/SemesterAdministration.module.scss @@ -1,6 +1,6 @@ .actions { margin-top: .5rem; display: flex; - justify-content: flex-end; + justify-content: flex-start; column-gap: 20px; } \ No newline at end of file diff --git a/src/components/SemesterAdministration/SemesterAdministration.tsx b/src/components/SemesterAdministration/SemesterAdministration.tsx index 312ac5d3..b9617436 100644 --- a/src/components/SemesterAdministration/SemesterAdministration.tsx +++ b/src/components/SemesterAdministration/SemesterAdministration.tsx @@ -41,8 +41,11 @@ export const SemesterAdministration: FC = () => { const [textareaContent, setTextareaContent] = useState('') - const getSemesterResults = async () => { - const {data} = await axios.get(`/api/competition/semester/${semesterId}/results`) + const getResults = async (seriesId: number | null) => { + const isSemester = seriesId === null + const {data} = await axios.get( + isSemester ? `/api/competition/semester/${semesterId}/results` : `/api/competition/series/${seriesId}/results`, + ) setTextareaContent( data .map((result: Result) => { @@ -55,9 +58,14 @@ export const SemesterAdministration: FC = () => { } } const name = `${result.registration.profile.first_name} ${result.registration.profile.last_name}` - const subtotal = result.subtotal[0] - const points = result.solutions[1].map((problem) => problem.points).join('&') - return `${rank}&${name}&${result.registration.school.abbreviation}&${result.registration.grade}&${subtotal}&${points}&${result.total}\\\\` + if (isSemester) { + const subtotal = result.subtotal[0] + const points = result.solutions[1].map((problem) => problem.points).join('&') + return `${rank}&${name}&${result.registration.school.abbreviation}&${result.registration.grade}&${subtotal}&${points}&${result.total}\\\\` + } else { + const points = result.solutions[0].map((problem) => problem.points).join('&') + return `${rank}&${name}&${result.registration.school.abbreviation}&${result.registration.grade}&${points}&${result.total}\\\\` + } }) .join('\n'), ) @@ -110,7 +118,14 @@ export const SemesterAdministration: FC = () => { ))}

Generovanie dát

- + {[...semester.series_set].reverse().map((series) => ( +
+ +
+ ))} + +
+
Zoznam riešiteľov diff --git a/src/types/api/generated/competition.ts b/src/types/api/generated/competition.ts index 62c5f460..e1ec32ba 100644 --- a/src/types/api/generated/competition.ts +++ b/src/types/api/generated/competition.ts @@ -121,7 +121,7 @@ export interface Series { } export interface SeriesWithProblems { - id?: number + id: number can_participate?: any is_registered?: any problems: Problem[]