From a12aca410ab7fd6ecffe6caa5c7491ef17aee510 Mon Sep 17 00:00:00 2001 From: thirdmadman Date: Thu, 7 Sep 2023 21:54:39 +0200 Subject: [PATCH] fix: correct score filters (github and name) (#2278) --- client/src/modules/Score/components/ScoreTable/index.tsx | 9 ++++++++- client/src/modules/Score/hooks/useScorePaging.tsx | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/client/src/modules/Score/components/ScoreTable/index.tsx b/client/src/modules/Score/components/ScoreTable/index.tsx index dd4c93d5c6..6eeddf137a 100644 --- a/client/src/modules/Score/components/ScoreTable/index.tsx +++ b/client/src/modules/Score/components/ScoreTable/index.tsx @@ -41,7 +41,7 @@ export function ScoreTable(props: Props) { const router = useRouter(); const { width } = useWindowDimensions(); const { activeOnly } = props; - const { ['mentor.githubId']: mentor, cityName } = router.query; + const { ['mentor.githubId']: mentor, cityName, githubId, name } = router.query; const [isVisibleSetting, setIsVisibleSettings] = useState(false); const [columns, setColumns] = useState[]>([]); @@ -87,6 +87,13 @@ export function ScoreTable(props: Props) { filters = { ...filters, ['mentor.githubId']: mentor } as ScoreTableFilters; } + if (!isUndefined(githubId)) { + filters = { ...filters, githubId } as ScoreTableFilters; + } + if (!isUndefined(name)) { + filters = { ...filters, name } as ScoreTableFilters; + } + const [courseScore, courseTasks] = await Promise.all([ courseService.getCourseScore(students.pagination, filters, students.order), courseTasksApi.getCourseTasks(props.course.id), diff --git a/client/src/modules/Score/hooks/useScorePaging.tsx b/client/src/modules/Score/hooks/useScorePaging.tsx index b515d23a41..8d6358d41b 100644 --- a/client/src/modules/Score/hooks/useScorePaging.tsx +++ b/client/src/modules/Score/hooks/useScorePaging.tsx @@ -19,8 +19,8 @@ export function useScorePaging(router: NextRouter, courseService: CourseService, const getCourseScore = useCallback( async (pagination: IPaginationInfo, filters: ScoreTableFilters, scoreOrder: ScoreOrder) => { - const { cityName, ['mentor.githubId']: mentor } = filters; - const newQueryParams = getQueryParams({ cityName, ['mentor.githubId']: mentor }, currentQuery); + const { cityName, ['mentor.githubId']: mentor, githubId, name } = filters; + const newQueryParams = getQueryParams({ cityName, ['mentor.githubId']: mentor, githubId, name }, currentQuery); setQueryParams(newQueryParams); const field = scoreOrder.column?.sorter || 'rank'; const courseScore = await courseService.getCourseScore(