From 01dc87e14e4079caaca5646890c8d31c21684658 Mon Sep 17 00:00:00 2001
From: Johannes Aamot-Skeidsvoll
Date: Thu, 30 Apr 2026 13:13:58 +0200
Subject: [PATCH 1/4] Make classroomId optional and fallback to id to fix
selection bug
---
src/classrooms/api/classrooms.api.ts | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/classrooms/api/classrooms.api.ts b/src/classrooms/api/classrooms.api.ts
index 693897a5..b56b3375 100644
--- a/src/classrooms/api/classrooms.api.ts
+++ b/src/classrooms/api/classrooms.api.ts
@@ -13,7 +13,8 @@ export type CreateClassroomRequest = {
}
export interface OwnedClassroomResponse {
- classroomId: number
+ classroomId?: number
+ id?: number
description: string
title: string
pupilCount: number
@@ -368,7 +369,7 @@ export async function getClassrooms(
)
return classrooms.map((c) => ({
- classroomId: c.classroomId,
+ classroomId: c.classroomId ?? c.id ?? 0,
title: c.title,
description: c.description,
pupilCount: c.pupilCount,
From 21dc1a53ed17175976285a67ff1b3867f62e5e21 Mon Sep 17 00:00:00 2001
From: Johannes Aamot-Skeidsvoll
Date: Thu, 30 Apr 2026 13:14:15 +0200
Subject: [PATCH 2/4] Update affected test
---
src/classrooms/_tests_/classrooms.api.spec.ts | 38 +++++++++++++++++++
1 file changed, 38 insertions(+)
create mode 100644 src/classrooms/_tests_/classrooms.api.spec.ts
diff --git a/src/classrooms/_tests_/classrooms.api.spec.ts b/src/classrooms/_tests_/classrooms.api.spec.ts
new file mode 100644
index 00000000..ae868b8c
--- /dev/null
+++ b/src/classrooms/_tests_/classrooms.api.spec.ts
@@ -0,0 +1,38 @@
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { getClassrooms } from '@/classrooms/api/classrooms.api'
+
+describe('classrooms.api', () => {
+ afterEach(() => {
+ vi.unstubAllGlobals()
+ })
+
+ it('normalizes owned classrooms that use id instead of classroomId', async () => {
+ const fetchMock = vi.fn().mockResolvedValue({
+ ok: true,
+ json: async () => [
+ {
+ id: 7,
+ title: 'Detektivgjengen 6B',
+ description: '',
+ pupilCount: 24,
+ pendingPupilCount: 0,
+ teacherCount: 2,
+ taskCount: 5,
+ },
+ ],
+ })
+ vi.stubGlobal('fetch', fetchMock)
+
+ await expect(getClassrooms('Bearer token')).resolves.toEqual([
+ {
+ classroomId: 7,
+ title: 'Detektivgjengen 6B',
+ description: '',
+ pupilCount: 24,
+ pendingPupilCount: 0,
+ teacherCount: 2,
+ taskCount: 5,
+ },
+ ])
+ })
+})
From 228c2976c43b4ee621d41a4b8fdceb1087ae22b3 Mon Sep 17 00:00:00 2001
From: Johannes Aamot-Skeidsvoll
Date: Thu, 30 Apr 2026 13:53:15 +0200
Subject: [PATCH 3/4] Make locked stops unavailable in notebook
---
src/notebook/components/NotebookComponent.vue | 29 +++++++++++++++++--
.../components/NotebookSidebarComponent.vue | 16 ++++++++++
2 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/src/notebook/components/NotebookComponent.vue b/src/notebook/components/NotebookComponent.vue
index 4ca4cd63..684fc015 100644
--- a/src/notebook/components/NotebookComponent.vue
+++ b/src/notebook/components/NotebookComponent.vue
@@ -99,6 +99,9 @@ const currentStop = computed(
() =>
mapStops.value.find((stop) => stop.stopId === currentStopId.value) ?? null,
)
+const currentStopUnlocked = computed(
+ () => isTeacherReview.value || currentStop.value?.status !== 'LOCKED',
+)
const sectionTitle = computed(() => {
if (currentStop.value?.title) {
return currentStop.value.title
@@ -229,6 +232,14 @@ function selectSection(index: number) {
return
}
+ if (
+ !isTeacherReview.value &&
+ mapStops.value.find((stop) => stop.stopId === sectionStopIds.value[index])
+ ?.status === 'LOCKED'
+ ) {
+ return
+ }
+
currentSection.value = index
clampCurrentPage()
}
@@ -329,6 +340,12 @@ async function createEntry() {
return
}
+ if (!currentStopUnlocked.value) {
+ status.value = 'error'
+ errorMessage.value = t('map.lockedMessage')
+ return
+ }
+
if (currentClassroomId.value === null || defaultCreateStopId.value === null) {
status.value = 'error'
errorMessage.value = t('notebook.errors.missingStop')
@@ -601,6 +618,7 @@ onBeforeUnmount(() => {
{
{{ errorMessage }}
-