diff --git a/frontend/frontend/src/pages/assignmentPage/AssignmentPage.tsx b/frontend/frontend/src/pages/assignmentPage/AssignmentPage.tsx
index 29208f90..d8b7fdb0 100644
--- a/frontend/frontend/src/pages/assignmentPage/AssignmentPage.tsx
+++ b/frontend/frontend/src/pages/assignmentPage/AssignmentPage.tsx
@@ -450,7 +450,7 @@ export function AssignmentPage() {
)
) &&
!assignment.extra_deadline
- ? 'red'
+ ? 'error.main'
: 'text.primary'
}
>
@@ -531,7 +531,7 @@ export function AssignmentPage() {
assignment.extra_deadline
)
)
- ? 'red'
+ ? 'error.main'
: 'text.primary'
}
>
@@ -821,7 +821,7 @@ export function AssignmentPage() {
)
) &&
!assignment.extra_deadline
- ? 'red'
+ ? 'error.main'
: 'text.primary'
}
>
@@ -945,7 +945,7 @@ export function AssignmentPage() {
assignment.extra_deadline
)
)
- ? 'red'
+ ? 'error.main'
: 'text.primary'
}
>
diff --git a/frontend/frontend/src/pages/subjectsPage/AssignmentListItemSubjectsPage.tsx b/frontend/frontend/src/pages/subjectsPage/AssignmentListItemSubjectsPage.tsx
index e39e2785..5b9013fa 100644
--- a/frontend/frontend/src/pages/subjectsPage/AssignmentListItemSubjectsPage.tsx
+++ b/frontend/frontend/src/pages/subjectsPage/AssignmentListItemSubjectsPage.tsx
@@ -4,6 +4,7 @@ import {
ListItemButton,
ListItemText,
Tooltip,
+ Typography,
} from '@mui/material'
import { useNavigate } from 'react-router-dom'
import { t } from 'i18next'
@@ -15,12 +16,14 @@ import React, { useState } from 'react'
import dayjs, { Dayjs } from 'dayjs'
import { Score } from '../../components/SubmissionListItemTeacherPage.tsx'
import { EvenlySpacedRow } from '../../components/CustomComponents.tsx'
+import { Submission } from '../submissionPage/SubmissionPage.tsx'
/**
* This component is used to display a single assignment in the list of assignments.
* @param projectName: string - the name of the project
* @param dueDate: Date - the due date of the project
* @param submissions: number - number of submissions for the project
+ * @param lastSubmission: Submission - last submission for the project
* @param score: number - assigned score on the project
* @param isStudent: boolean - wether the user is a student or a teacher
* @param archived: boolean - wether the assignment is archived
@@ -34,6 +37,7 @@ interface AssignmentListItemSubjectsPageProps {
projectName: string
dueDate: Dayjs | undefined
submissions: number
+ lastSubmission?: Submission
score: Score | undefined
maxScore: number
isStudent: boolean
@@ -50,6 +54,7 @@ export function AssignmentListItemSubjectsPage({
projectName,
dueDate,
submissions,
+ lastSubmission,
score,
maxScore,
isStudent,
@@ -87,15 +92,33 @@ export function AssignmentListItemSubjectsPage({
,
-
+
+ {dueDate
? dayjs(dueDate).format(
'DD/MM/YYYY HH:mm'
)
- : t('no_deadline')
- }
- />,
+ : t('no_deadline')}
+
+ ,
0
@@ -132,15 +155,25 @@ export function AssignmentListItemSubjectsPage({
,
-
+
+ {dueDate
? dayjs(dueDate).format(
'DD/MM/YYYY HH:mm'
)
- : t('no_deadline')
- }
- />,
+ : t('no_deadline')}
+
+ ,
([])
+ const [lastSubmission, setLastSubmission] = useState()
// state to keep track of the loading state
const [loading, setLoading] = useState(true)
@@ -90,10 +91,11 @@ export function ProjectsView({
const submissionsResponse = await instance.get(
`/indieningen/?groep=${projectstudent.group.groep_id?.toString()}&project=${projectstudent.assignment.project_id.toString()}`
)
- const lastSubmission =
- submissionsResponse.data[
- submissionsResponse.data.length - 1
- ]
+ const lastSubmission = submissionsResponse.data.sort(
+ (a: Submission, b: Submission) =>
+ dayjs(a.tijdstip).isAfter(dayjs(b.tijdstip)) ? 1 : -1
+ )[0]
+ setLastSubmission(lastSubmission)
return {
...projectstudent,
lastSubmission: lastSubmission,
@@ -142,7 +144,30 @@ export function ProjectsView({
)
const scoreArray = await Promise.all(scorePromises)
- setProjects(scoreArray)
+ scoreArray.sort((a, b) => {
+ return dayjs(a.assignment.deadline).isAfter(
+ dayjs(b.assignment.deadline)
+ )
+ ? 1
+ : -1
+ })
+
+ const pastAndTodayDeadlines: ProjectStudent[] = []
+ const futureDeadlines: ProjectStudent[] = []
+ const today = dayjs()
+ // Separate the items based on their deadline
+ scoreArray.forEach((item) => {
+ if (
+ dayjs(item.assignment.deadline).isBefore() ||
+ dayjs(item.assignment.deadline).isSame(today)
+ ) {
+ pastAndTodayDeadlines.push(item)
+ } else {
+ futureDeadlines.push(item)
+ }
+ })
+
+ setProjects(futureDeadlines.concat(pastAndTodayDeadlines))
} catch (e) {
console.error('Error fetching all data:', e)
} finally {
@@ -264,6 +289,9 @@ export function ProjectsView({
<>
-
+
@@ -339,11 +348,11 @@ export function SubjectsPage() {
invitationLink={`${window.location.href}/accept_invitation`}
/>
-
-
-
+
+ placement={'top'}
+ >