diff --git a/frontend/src/views/ProjectsView.vue b/frontend/src/views/ProjectsView.vue index 2301176a..6a158210 100644 --- a/frontend/src/views/ProjectsView.vue +++ b/frontend/src/views/ProjectsView.vue @@ -28,15 +28,16 @@ import { computed, ref } from "vue"; import type Project from "@/models/Project"; const { data: projects, isLoading, isError } = useProjectsQuery(); -const noProjectsFound = computed(() => projects.value?.length === 0); +const allProjects = computed(() => + isLoading.value ? [] : [...projects.value!.as_student, ...projects.value!.as_instructor] +); +const noProjectsFound = computed(() => allProjects.value.length === 0); const activeButton = ref("notFinished"); const filteredProjects = computed(() => { - if (!projects.value) return []; - const now = new Date(); - const sortedProjects = projects.value + const sortedProjects = allProjects.value .slice() .sort( (a: Project, b: Project) => diff --git a/frontend/tests/views/ProjectsView.spec.ts b/frontend/tests/views/ProjectsView.spec.ts index e83196f3..3f39887b 100644 --- a/frontend/tests/views/ProjectsView.spec.ts +++ b/frontend/tests/views/ProjectsView.spec.ts @@ -3,9 +3,10 @@ import {expect, describe, it, vi} from "vitest"; import ProjectsView from "@/views/ProjectsView.vue" import {ref} from "vue"; -const mockProjects = [ - {id: 1} -] +const mockProjects = { + as_student: [{id: 1}], + as_instructor: [{id: 2}], +}; const testProjectsQuery = { data: ref(mockProjects),