diff --git a/app/src/routes/(time)/gallery/+page.svelte b/app/src/routes/(time)/gallery/+page.svelte index 06de84543..d043171ea 100644 --- a/app/src/routes/(time)/gallery/+page.svelte +++ b/app/src/routes/(time)/gallery/+page.svelte @@ -2,7 +2,6 @@ import "../../../app.postcss"; import { onMount } from "svelte"; import { getCourseSummary, type CourseSummary } from "$lib/services/utils/all-course-access"; - import { readVisits } from "$lib/services/utils/firebase"; import { ProgressBar } from "@skeletonlabs/skeleton"; import TutorsShell from "$lib/ui/app-shells/TutorsShell.svelte"; import GalleryCard from "$lib/ui/learning-objects/layout/GalleryCard.svelte"; @@ -13,26 +12,24 @@ let los: CourseSummary[] = []; let modules = 0; - let totalVisits = 0; let subTitle = ""; onMount(async () => { if (data.allCourses) { data.allCourses.forEach(async (courseId: string) => { try { - const visits = await readVisits(courseId); - if (visits) { - totalVisits += visits; - const courseSummary = await getCourseSummary(courseId); - if (!courseSummary.isPrivate) { - modules++; - subTitle = `Showcasing ${modules} modules`; - los.push(courseSummary); - los = [...los]; + const courseSummary = await getCourseSummary(courseId); + if (!courseSummary.isPrivate) { + modules++; + subTitle = `Showcasing ${modules} modules`; + los.push(courseSummary); + if (modules === data.allCourses.length) { los.sort((lo1: CourseSummary, lo2: CourseSummary) => lo1.title.localeCompare(lo2.title)); } + los = [...los]; } } catch (error: any) { + modules--; console.log(`invalid course ${courseId} : ${error.message}`); } }); @@ -41,7 +38,9 @@ - + {#if modules < data.allCourses.length} + + {/if}
{#each los as lo} diff --git a/app/src/routes/(time)/gallery/+page.ts b/app/src/routes/(time)/gallery/+page.ts index 85337726b..a1d34c032 100644 --- a/app/src/routes/(time)/gallery/+page.ts +++ b/app/src/routes/(time)/gallery/+page.ts @@ -6,10 +6,9 @@ const validCourses = [ "classic-design-patterns", "bi-vis-2023", "careerdevelopment", - "wit-hdip-comp-sci-2022-computer-systems", "dsa1-jan-2024", "wit-hdip-comp-sci-2021-database", - "devfor.netlify", + "devfor", "enterprise-apps", "fsf21", "funcprog23-reg", @@ -18,8 +17,7 @@ const validCourses = [ "setu-mgd", "netfor", "of-2022s2-8z1", - "osforensic", - "bsa-hci-webdesign", + "osforensics", "ictforforestry", "placement-project", "professionalcomms", @@ -41,7 +39,7 @@ const validCourses = [ "website-development-2", "adv-full-stack-oth-2023", "business-analytics2-2023", - "wit-hdip-comp-sci-2022-computer-system", + "wit-hdip-comp-sci-2022-computer-systems", "wit-hdip-comp-sci-2022-security", "wit-hdip-comp-sci-2022-devops", "ict-for-scientists", @@ -53,7 +51,9 @@ const validCourses = [ "wad2-2022-setu", "wit-hdip-comp-sci-2023-workshop-2-4", "wit-hdip-comp-sci-2023-workshop-1-3", - "mobile-app-dev-tutors-2022" + "mobile-app-dev-tutors-2022", + "wit-hdip-comp-sci-2022", + "life-etc2022" ]; export const load: PageLoad = async ({ params }) => {