From 148101dd01f82910986f5331e23760b6feb07d75 Mon Sep 17 00:00:00 2001 From: Jan Gaura Date: Thu, 17 Oct 2024 15:12:59 +0200 Subject: [PATCH] [Fix] Student transfer hotfix --- frontend/src/StudentTransfer.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/StudentTransfer.svelte b/frontend/src/StudentTransfer.svelte index c7a05522..55a91ef8 100644 --- a/frontend/src/StudentTransfer.svelte +++ b/frontend/src/StudentTransfer.svelte @@ -22,7 +22,10 @@ $: canTransfer = assignments.length && notAssignedCount == 0 && uniqueAssignment async function loadClasses() { const res = await fetch('/api/classes/all'); data = await res.json(); - semester = Object.keys(data.semesters)[Object.keys(data.semesters).length - 1]; + + if ( Object.keys(data.semesters).length > 0 ) { + semester = Object.keys(data.semesters)[0]; + } } async function loadClass() {