From 04c9ff24ea55521bcb178a73e2e7d9420c20b8e4 Mon Sep 17 00:00:00 2001 From: Joao Ramos Date: Tue, 3 Sep 2024 21:15:59 +0100 Subject: [PATCH] Changed the criteria for the filter on student assignment --- src/dashboards/Student.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/dashboards/Student.tsx b/src/dashboards/Student.tsx index 3a8609d9..3d128d04 100644 --- a/src/dashboards/Student.tsx +++ b/src/dashboards/Student.tsx @@ -27,6 +27,7 @@ import {useRouter} from "next/router"; import {useEffect, useState} from "react"; import {BsArrowRepeat, BsBook, BsClipboard, BsFileEarmarkText, BsHeadphones, BsMegaphone, BsPen, BsPencil, BsStar} from "react-icons/bs"; import {toast} from "react-toastify"; +import { activeAssignmentFilter } from "@/utils/assignments"; interface Props { user: User; @@ -69,6 +70,9 @@ export default function StudentDashboard({user, users, linkedCorporate}: Props) }); }; + const studentAssignments = assignments + .filter(activeAssignmentFilter); + return ( <> {linkedCorporate && ( @@ -119,10 +123,9 @@ export default function StudentDashboard({user, users, linkedCorporate}: Props) - {assignments.filter((a) => moment(a.endDate).isSameOrAfter(moment())).length === 0 && + {studentAssignments.length === 0 && "Assignments will appear here. It seems that for now there are no assignments for you."} - {assignments - .filter((a) => moment(a.endDate).isSameOrAfter(moment())) + {studentAssignments .sort((a, b) => moment(a.startDate).diff(b.startDate)) .map((assignment) => (