Skip to content

Commit 3d0f316

Browse files
committed
Sort students next solutions in table orderф
1 parent 0479395 commit 3d0f316

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

hwproj.front/src/components/Solutions/StudentSolutionsPage.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,13 @@ const StudentSolutionsPage: FC<RouteComponentProps<IStudentSolutionsPageProps>>
6060

6161
const getNextUnratedSolution = async () => {
6262
const unratedSolutions = await ApiSingleton.solutionsApi.apiSolutionsUnratedSolutionsGet(taskId)
63-
const nextUnratedSolution = unratedSolutions.unratedSolutions!.filter(t => t.student!.userId !== studentId)[0]
63+
const nextUnratedSolution = unratedSolutions.unratedSolutions!
64+
.filter(t => t.student!.userId !== studentId)
65+
.sort((s1, s2) => {
66+
const cm1 = `${s1.student!.surname} ${s1.student!.name}`
67+
const cm2 = `${s2.student!.surname} ${s2.student!.name}`
68+
return cm1.localeCompare(cm2)
69+
})[0]
6470

6571
if (nextUnratedSolution) {
6672
window.location.assign(`/task/${nextUnratedSolution.taskId}/${nextUnratedSolution.student!.userId}`)

0 commit comments

Comments
 (0)