diff --git a/VERSION b/VERSION index e76466f..46e7081 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.02-beta +0.4.03-beta diff --git a/public/js/admin.js b/public/js/admin.js index 4e26c1b..8496a3c 100644 --- a/public/js/admin.js +++ b/public/js/admin.js @@ -433,7 +433,7 @@ /* klas (uitwisselen met andere klassen) */ const cs = classSel(u.classId); cs.addEventListener("change", async ()=>{ - try{ await api("/admin/users/"+u.id, {method:"PATCH", body:{classId: cs.value ? +cs.value : null}}); } + try{ await api("/admin/users/"+u.id, {method:"PATCH", body:{classId: cs.value ? +cs.value : null}}); reload(); } catch(e){ note(e.message); } }); tools.appendChild(field("amFieldClass", cs)); diff --git a/public/js/core.js b/public/js/core.js index 9947350..e613fba 100644 --- a/public/js/core.js +++ b/public/js/core.js @@ -2,7 +2,7 @@ "use strict"; /* version — shown until /api/version resolves (or if the fetch fails, e.g. offline). Kept in sync by hand with the VERSION file at the repo root on every release. */ -const VERSION = "0.4.02-beta"; +const VERSION = "0.4.03-beta"; (function(){ const tag = document.getElementById("verTag"); tag.textContent = "v"+VERSION; diff --git a/test/schools.test.js b/test/schools.test.js index 5c0b96c..e11d299 100644 --- a/test/schools.test.js +++ b/test/schools.test.js @@ -140,6 +140,15 @@ test('systeemmanager koppelt een gebruiker aan een school en maakt hem weer los' await app3.close(); }); +test('leerling verplaatsen naar een andere klas (uitwisselen) werkt', async () => { + const { app, calls } = await makeApp(superUser, { id: 9, role: 'pupil', school_id: 2, class_id: 50, username: 'lena' }); + const res = await app.inject({ method: 'PATCH', url: '/api/admin/users/9', cookies, payload: { classId: 100 } }); + assert.equal(res.statusCode, 200, res.body); + const upd = calls.find((c) => c.sql === 'UPDATE users SET class_id = $1 WHERE id = $2'); + assert.deepEqual(upd.params, [100, 9]); + await app.close(); +}); + test('school koppelen kan niet door een schoolbeheerder en niet op super/parent', async () => { const { app, calls } = await makeAppWithSchool(admin, { id: 7, role: 'teacher', school_id: 2, username: 'juf' }); await app.inject({ method: 'PATCH', url: '/api/admin/users/7', cookies, payload: { schoolId: 3 } });