Skip to content

Commit

Permalink
fix: correct score filters (github and name) (#2278)
Browse files Browse the repository at this point in the history
  • Loading branch information
thirdmadman authored Sep 7, 2023
1 parent 31b0312 commit a12aca4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion client/src/modules/Score/components/ScoreTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<ColumnType<ScoreStudentDto>[]>([]);
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions client/src/modules/Score/hooks/useScorePaging.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit a12aca4

Please sign in to comment.