Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #370 from SELab-2/add_remove_roles
Browse files Browse the repository at this point in the history
students can see archived projects
  • Loading branch information
matt01y authored May 23, 2024
2 parents 9e48e56 + 8acc5b4 commit d948209
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions frontend/src/pages/student/ProjectsViewStudent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {deadline_to_string} from "../../utils/helper.ts";

function GenerateTableRowProjects(data: CompleteProjectStudent[]): TableRowProjects[] {

const { t } = useTranslation();
const {t} = useTranslation();

return data.map((project_item) => {

Expand All @@ -40,8 +40,8 @@ function GenerateTableRowProjects(data: CompleteProjectStudent[]): TableRowProje
id: project_item.course_id
},
numberOfSubmissions: null,
deadline: deadline_to_string(project_item.project_deadline),
status: project_status
deadline: deadline_to_string(project_item.project_deadline) ?? "",
status: project_status ?? null
}
})
}
Expand All @@ -52,10 +52,11 @@ export default function ProjectsViewStudent(): JSX.Element {
const projects_data = data.projects

const active_projects = projects_data.filter((project) => project.project_visible && !project.project_archived)

const { t } = useTranslation();
const archived_projects = projects_data.filter((project) => project.project_visible && project.project_archived)
const {t} = useTranslation();

const tableProjectsActive: TableRowProjects[] = GenerateTableRowProjects(active_projects)
const tableProjectsArchived: TableRowProjects[] = GenerateTableRowProjects(archived_projects)

return (
<>
Expand All @@ -68,7 +69,12 @@ export default function ProjectsViewStudent(): JSX.Element {
</div>
<div className={"student-main is-flex is-justify-content-center"}>
<div className={"table-page is-flex is-flex-direction-column"}>
<Table title={t('projects.active')} data={tableProjectsActive} ignoreKeys={["numberOfSubmissions"]}
<Table title={t('projects.active')} data={tableProjectsActive}
ignoreKeys={["numberOfSubmissions"]}
home={"student"}/>
<div className={"my-5"}/>
<Table title={t('projects.archived')} data={tableProjectsArchived}
ignoreKeys={["numberOfSubmissions", "deadline", "status"]}
home={"student"}/>
<div className={"my-5"}/>
</div>
Expand Down

0 comments on commit d948209

Please sign in to comment.