From 8894846f5b2010353db7fc2531c6e67908893d84 Mon Sep 17 00:00:00 2001 From: Maximilian Oertel Date: Mon, 14 Oct 2024 18:20:49 +0100 Subject: [PATCH 01/12] Fix SWR task loading --- src/components/tasks/TaskSWR.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/tasks/TaskSWR.vue b/src/components/tasks/TaskSWR.vue index e5d383bd2..5d5134aaa 100644 --- a/src/components/tasks/TaskSWR.vue +++ b/src/components/tasks/TaskSWR.vue @@ -25,6 +25,7 @@ let TaskLauncher; const taskId = props.taskId; const { version } = packageLockJson.packages['node_modules/@bdelab/roar-swr']; const router = useRouter(); +const taskStarted = ref(false); const gameStarted = ref(false); const authStore = useAuthStore(); const gameStore = useGameStore(); @@ -75,14 +76,16 @@ onBeforeUnmount(() => { watch( [isFirekitInit, isLoadingUserData], async ([newFirekitInitValue, newLoadingUserData]) => { - if (newFirekitInitValue && !newLoadingUserData) await startTask(); + if (newFirekitInitValue && !newLoadingUserData && !taskStarted.value) { + taskStarted.value = true; + const { selectedAdmin } = storeToRefs(gameStore); + await startTask(selectedAdmin); + } }, { immediate: true }, ); -const { selectedAdmin } = storeToRefs(gameStore); - -async function startTask() { +async function startTask(selectedAdmin) { try { let checkGameStarted = setInterval(function () { // Poll for the preload trials progress bar to exist and then begin the game From e67de3b783adbc8578677a80ffc30064465490d5 Mon Sep 17 00:00:00 2001 From: Maximilian Oertel Date: Mon, 14 Oct 2024 18:25:19 +0100 Subject: [PATCH 02/12] Fix Vocab task loading --- src/components/tasks/TaskVocab.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/tasks/TaskVocab.vue b/src/components/tasks/TaskVocab.vue index b2c80b53e..1ed40657b 100644 --- a/src/components/tasks/TaskVocab.vue +++ b/src/components/tasks/TaskVocab.vue @@ -25,6 +25,7 @@ let TaskLauncher; const taskId = props.taskId; const { version } = packageLockJson.packages['node_modules/@bdelab/roar-vocab']; const router = useRouter(); +const taskStarted = ref(false); const gameStarted = ref(false); const authStore = useAuthStore(); const gameStore = useGameStore(); @@ -75,14 +76,16 @@ onBeforeUnmount(() => { watch( [isFirekitInit, isLoadingUserData], async ([newFirekitInitValue, newLoadingUserData]) => { - if (newFirekitInitValue && !newLoadingUserData) await startTask(); + if (newFirekitInitValue && !newLoadingUserData && !taskStarted.value) { + taskStarted.value = true; + const { selectedAdmin } = storeToRefs(gameStore); + await startTask(selectedAdmin); + } }, { immediate: true }, ); -const { selectedAdmin } = storeToRefs(gameStore); - -async function startTask() { +async function startTask(selectedAdmin) { try { let checkGameStarted = setInterval(function () { // Poll for the preload trials progress bar to exist and then begin the game From 22ba44b9af49c8f3a3eeff4fc1e079841c64b4b8 Mon Sep 17 00:00:00 2001 From: Maximilian Oertel Date: Mon, 14 Oct 2024 18:31:43 +0100 Subject: [PATCH 03/12] Fix SRE task loading --- src/components/tasks/TaskSRE.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/tasks/TaskSRE.vue b/src/components/tasks/TaskSRE.vue index ebbdbc4de..8cf9df983 100644 --- a/src/components/tasks/TaskSRE.vue +++ b/src/components/tasks/TaskSRE.vue @@ -25,6 +25,7 @@ let TaskLauncher; const taskId = props.taskId; const { version } = packageLockJson.packages['node_modules/@bdelab/roar-sre']; const router = useRouter(); +const taskStarted = ref(false); const gameStarted = ref(false); const authStore = useAuthStore(); const gameStore = useGameStore(); @@ -75,14 +76,16 @@ onBeforeUnmount(() => { watch( [isFirekitInit, isLoadingUserData], async ([newFirekitInitValue, newLoadingUserData]) => { - if (newFirekitInitValue && !newLoadingUserData) await startTask(); + if (newFirekitInitValue && !newLoadingUserData && !taskStarted.value) { + taskStarted.value = true; + const { selectedAdmin } = storeToRefs(gameStore); + await startTask(selectedAdmin); + } }, { immediate: true }, ); -const { selectedAdmin } = storeToRefs(gameStore); - -async function startTask() { +async function startTask(selectedAdmin) { try { let checkGameStarted = setInterval(function () { // Poll for the preload trials progress bar to exist and then begin the game From 458b3a066c31250d3272e4cb61e696ba805dd568 Mon Sep 17 00:00:00 2001 From: Maximilian Oertel Date: Mon, 14 Oct 2024 18:33:01 +0100 Subject: [PATCH 04/12] Fix Ran task loading --- src/components/tasks/TaskRan.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/tasks/TaskRan.vue b/src/components/tasks/TaskRan.vue index 46af24100..30489ee38 100644 --- a/src/components/tasks/TaskRan.vue +++ b/src/components/tasks/TaskRan.vue @@ -25,6 +25,7 @@ let TaskLauncher; const taskId = props.taskId; const { version } = packageLockJson.packages['node_modules/@bdelab/roav-ran']; const router = useRouter(); +const taskStarted = ref(false); const gameStarted = ref(false); const authStore = useAuthStore(); const gameStore = useGameStore(); @@ -75,14 +76,16 @@ onBeforeUnmount(() => { watch( [isFirekitInit, isLoadingUserData], async ([newFirekitInitValue, newLoadingUserData]) => { - if (newFirekitInitValue && !newLoadingUserData) await startTask(); + if (newFirekitInitValue && !newLoadingUserData && !taskStarted.value) { + taskStarted.value = true; + const { selectedAdmin } = storeToRefs(gameStore); + await startTask(selectedAdmin); + } }, { immediate: true }, ); -const { selectedAdmin } = storeToRefs(gameStore); - -async function startTask() { +async function startTask(selectedAdmin) { try { let checkGameStarted = setInterval(function () { // Poll for the preload trials progress bar to exist and then begin the game From a33aaf0165d59c57415ee16a24339413868bea98 Mon Sep 17 00:00:00 2001 From: Maximilian Oertel Date: Mon, 14 Oct 2024 18:34:14 +0100 Subject: [PATCH 05/12] Fix PA task loading --- src/components/tasks/TaskPA.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/tasks/TaskPA.vue b/src/components/tasks/TaskPA.vue index 056513d64..49458b641 100644 --- a/src/components/tasks/TaskPA.vue +++ b/src/components/tasks/TaskPA.vue @@ -25,6 +25,7 @@ let TaskLauncher; const taskId = props.taskId; const { version } = packageLockJson.packages['node_modules/@bdelab/roar-pa']; const router = useRouter(); +const taskStarted = ref(false); const gameStarted = ref(false); const authStore = useAuthStore(); const gameStore = useGameStore(); @@ -75,14 +76,16 @@ onBeforeUnmount(() => { watch( [isFirekitInit, isLoadingUserData], async ([newFirekitInitValue, newLoadingUserData]) => { - if (newFirekitInitValue && !newLoadingUserData) await startTask(); + if (newFirekitInitValue && !newLoadingUserData && !taskStarted.value) { + taskStarted.value = true; + const { selectedAdmin } = storeToRefs(gameStore); + await startTask(selectedAdmin); + } }, { immediate: true }, ); -const { selectedAdmin } = storeToRefs(gameStore); - -async function startTask() { +async function startTask(selectedAdmin) { try { let checkGameStarted = setInterval(function () { // Poll for the preload trials progress bar to exist and then begin the game From 104a33bc90f662c121f001ef265c1edb5154b262 Mon Sep 17 00:00:00 2001 From: Maximilian Oertel Date: Mon, 14 Oct 2024 18:35:14 +0100 Subject: [PATCH 06/12] Fix Multichoice task loading --- src/components/tasks/TaskMultichoice.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/tasks/TaskMultichoice.vue b/src/components/tasks/TaskMultichoice.vue index c279d0ea5..363ba7d45 100644 --- a/src/components/tasks/TaskMultichoice.vue +++ b/src/components/tasks/TaskMultichoice.vue @@ -25,6 +25,7 @@ let TaskLauncher; const taskId = props.taskId; const { version } = packageLockJson.packages['node_modules/@bdelab/roar-multichoice']; const router = useRouter(); +const taskStarted = ref(false); const gameStarted = ref(false); const authStore = useAuthStore(); const gameStore = useGameStore(); @@ -75,14 +76,16 @@ onBeforeUnmount(() => { watch( [isFirekitInit, isLoadingUserData], async ([newFirekitInitValue, newLoadingUserData]) => { - if (newFirekitInitValue && !newLoadingUserData) await startTask(); + if (newFirekitInitValue && !newLoadingUserData && !taskStarted.value) { + taskStarted.value = true; + const { selectedAdmin } = storeToRefs(gameStore); + await startTask(selectedAdmin); + } }, { immediate: true }, ); -const { selectedAdmin } = storeToRefs(gameStore); - -async function startTask() { +async function startTask(selectedAdmin) { try { let checkGameStarted = setInterval(function () { // Poll for the preload trials progress bar to exist and then begin the game From 825ddd0b7d048ee12996b12f1a162bbdfe7463ec Mon Sep 17 00:00:00 2001 From: Maximilian Oertel Date: Mon, 14 Oct 2024 18:38:03 +0100 Subject: [PATCH 07/12] Fix MEP task loading --- src/components/tasks/TaskMEP.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/tasks/TaskMEP.vue b/src/components/tasks/TaskMEP.vue index f257172b2..a58310676 100644 --- a/src/components/tasks/TaskMEP.vue +++ b/src/components/tasks/TaskMEP.vue @@ -25,6 +25,7 @@ let TaskLauncher; const taskId = props.taskId; const { version } = packageLockJson.packages['node_modules/@bdelab/roav-mep']; const router = useRouter(); +const taskStarted = ref(false); const gameStarted = ref(false); const authStore = useAuthStore(); const gameStore = useGameStore(); @@ -75,14 +76,16 @@ onBeforeUnmount(() => { watch( [isFirekitInit, isLoadingUserData], async ([newFirekitInitValue, newLoadingUserData]) => { - if (newFirekitInitValue && !newLoadingUserData) await startTask(); + if (newFirekitInitValue && !newLoadingUserData && !taskStarted.value) { + taskStarted.value = true; + const { selectedAdmin } = storeToRefs(gameStore); + await startTask(selectedAdmin); + } }, { immediate: true }, ); -const { selectedAdmin } = storeToRefs(gameStore); - -async function startTask() { +async function startTask(selectedAdmin) { try { let checkGameStarted = setInterval(function () { // Poll for the preload trials progress bar to exist and then begin the game From 5dca789962e4147421c67a689a24b1a1f0f828b3 Mon Sep 17 00:00:00 2001 From: Maximilian Oertel Date: Mon, 14 Oct 2024 18:39:07 +0100 Subject: [PATCH 08/12] Fix Levante task loading --- src/components/tasks/TaskLevante.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/tasks/TaskLevante.vue b/src/components/tasks/TaskLevante.vue index 37f07c216..6609a09ef 100644 --- a/src/components/tasks/TaskLevante.vue +++ b/src/components/tasks/TaskLevante.vue @@ -25,6 +25,7 @@ let levanteTaskLauncher; const taskId = props.taskId; const { version } = packageLockJson.packages['node_modules/@levante-framework/core-tasks']; const router = useRouter(); +const taskStarted = ref(false); const gameStarted = ref(false); const authStore = useAuthStore(); const gameStore = useGameStore(); @@ -76,14 +77,16 @@ onBeforeUnmount(() => { watch( [isFirekitInit, isLoadingUserData], async ([newFirekitInitValue, newLoadingUserData]) => { - if (newFirekitInitValue && !newLoadingUserData) await startTask(); + if (newFirekitInitValue && !newLoadingUserData && !taskStarted.value) { + taskStarted.value = true; + const { selectedAdmin } = storeToRefs(gameStore); + await startTask(selectedAdmin); + } }, { immediate: true }, ); -const { selectedAdmin } = storeToRefs(gameStore); - -async function startTask() { +async function startTask(selectedAdmin) { try { let checkGameStarted = setInterval(function () { // Poll for the preload trials progress bar to exist and then begin the game From a4ff7c6db97e42bf418c4bb1947337e3120beb17 Mon Sep 17 00:00:00 2001 From: Maximilian Oertel Date: Mon, 14 Oct 2024 18:41:08 +0100 Subject: [PATCH 09/12] Fix Letter task loading --- src/components/tasks/TaskLetter.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/tasks/TaskLetter.vue b/src/components/tasks/TaskLetter.vue index 552346347..84e831e9f 100644 --- a/src/components/tasks/TaskLetter.vue +++ b/src/components/tasks/TaskLetter.vue @@ -25,6 +25,7 @@ let TaskLauncher; const taskId = props.taskId; const { version } = packageLockJson.packages['node_modules/@bdelab/roar-letter']; const router = useRouter(); +const taskStarted = ref(false); const gameStarted = ref(false); const authStore = useAuthStore(); const gameStore = useGameStore(); @@ -75,14 +76,16 @@ onBeforeUnmount(() => { watch( [isFirekitInit, isLoadingUserData], async ([newFirekitInitValue, newLoadingUserData]) => { - if (newFirekitInitValue && !newLoadingUserData) await startTask(); + if (newFirekitInitValue && !newLoadingUserData && !taskStarted.value) { + taskStarted.value = true; + const { selectedAdmin } = storeToRefs(gameStore); + await startTask(selectedAdmin); + } }, { immediate: true }, ); -const { selectedAdmin } = storeToRefs(gameStore); - -async function startTask() { +async function startTask(selectedAdmin) { try { let checkGameStarted = setInterval(function () { // Poll for the preload trials progress bar to exist and then begin the game From ff59fbc2c4b91b325d47af2b075be653255d8ab5 Mon Sep 17 00:00:00 2001 From: Maximilian Oertel Date: Mon, 14 Oct 2024 18:41:53 +0100 Subject: [PATCH 10/12] Fix Fluency task loading --- src/components/tasks/TaskFluency.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/tasks/TaskFluency.vue b/src/components/tasks/TaskFluency.vue index 6ff64db0d..2916df6d1 100644 --- a/src/components/tasks/TaskFluency.vue +++ b/src/components/tasks/TaskFluency.vue @@ -25,6 +25,7 @@ let TaskLauncher; const taskId = props.taskId; const { version } = packageLockJson.packages['node_modules/@bdelab/roam-fluency']; const router = useRouter(); +const taskStarted = ref(false); const gameStarted = ref(false); const authStore = useAuthStore(); const gameStore = useGameStore(); @@ -75,14 +76,16 @@ onBeforeUnmount(() => { watch( [isFirekitInit, isLoadingUserData], async ([newFirekitInitValue, newLoadingUserData]) => { - if (newFirekitInitValue && !newLoadingUserData) await startTask(); + if (newFirekitInitValue && !newLoadingUserData && !taskStarted.value) { + taskStarted.value = true; + const { selectedAdmin } = storeToRefs(gameStore); + await startTask(selectedAdmin); + } }, { immediate: true }, ); -const { selectedAdmin } = storeToRefs(gameStore); - -async function startTask() { +async function startTask(selectedAdmin) { try { let checkGameStarted = setInterval(function () { // Poll for the preload trials progress bar to exist and then begin the game From dea85ee26a10f73a4d560647536b45f055ad28cc Mon Sep 17 00:00:00 2001 From: Maximilian Oertel Date: Mon, 14 Oct 2024 18:42:26 +0100 Subject: [PATCH 11/12] Fix Crowding task loading --- src/components/tasks/TaskCrowding.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/tasks/TaskCrowding.vue b/src/components/tasks/TaskCrowding.vue index 87bd37f7e..2c9de9668 100644 --- a/src/components/tasks/TaskCrowding.vue +++ b/src/components/tasks/TaskCrowding.vue @@ -25,6 +25,7 @@ let TaskLauncher; const taskId = props.taskId; const { version } = packageLockJson.packages['node_modules/@bdelab/roav-crowding']; const router = useRouter(); +const taskStarted = ref(false); const gameStarted = ref(false); const authStore = useAuthStore(); const gameStore = useGameStore(); @@ -75,14 +76,16 @@ onBeforeUnmount(() => { watch( [isFirekitInit, isLoadingUserData], async ([newFirekitInitValue, newLoadingUserData]) => { - if (newFirekitInitValue && !newLoadingUserData) await startTask(); + if (newFirekitInitValue && !newLoadingUserData && !taskStarted.value) { + taskStarted.value = true; + const { selectedAdmin } = storeToRefs(gameStore); + await startTask(selectedAdmin); + } }, { immediate: true }, ); -const { selectedAdmin } = storeToRefs(gameStore); - -async function startTask() { +async function startTask(selectedAdmin) { try { let checkGameStarted = setInterval(function () { // Poll for the preload trials progress bar to exist and then begin the game From 9faa3ea1e7dd074ebbc26cc44a742b089841eec9 Mon Sep 17 00:00:00 2001 From: Maximilian Oertel Date: Mon, 14 Oct 2024 21:35:59 +0100 Subject: [PATCH 12/12] Fix administration selection --- src/pages/HomeParticipant.vue | 42 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/pages/HomeParticipant.vue b/src/pages/HomeParticipant.vue index 529e9ae1b..d55cdad28 100644 --- a/src/pages/HomeParticipant.vue +++ b/src/pages/HomeParticipant.vue @@ -45,19 +45,11 @@
- { watch( [userData, selectedAdmin, userAssignments], - async ([updatedUserData, updatedSelectedAdmin]) => { - if (!_isEmpty(updatedUserData) && updatedSelectedAdmin) { + async ([newUserData, isSelectedAdminChanged]) => { + // If the assignments are still loading, abort. + if (isLoadingAssignments.value || isFetchingAssignments.value || !userAssignments.value.length) return; + + // If the selected admin changed, ensure consent was given before proceeding. + if (!_isEmpty(newUserData) && isSelectedAdminChanged) { await checkConsent(); } const selectedAdminId = selectedAdmin.value?.id; - const allAdminIds = (userAssignments.value ?? []).map((administration) => administration.id); - // If there is no selected administration or if the selected administration is not in the list - // of all administrations choose the first one after sorting alphabetically by publicName - if (allAdminIds.length > 0 && (!selectedAdminId || !allAdminIds.includes(selectedAdminId))) { - // Choose the first sorted administration - selectedAdmin.value = sortedUserAdministrations.value[0]; - } else { - // Although this seems redundant, we ensure that the selected admin is a fresh instance of the admin. - // This is relevant in the case that the game store does not flush properly. + const allAdminIds = userAssignments.value?.map((administration) => administration.id) ?? []; + + // Verify that we have a selected administration and it is in the list of all assigned administrations. + if (selectedAdminId && allAdminIds.includes(selectedAdminId)) { + // Ensure that the selected administration is a fresh instance of the administration. Whilst this seems redundant, + // this is apparently relevant in the case that the game store does not flush properly. selectedAdmin.value = sortedUserAdministrations.value.find( (administration) => administration.id === selectedAdminId, ); + + return; } + + // Otherwise, choose the first sorted administration if there is no selected administration. + selectedAdmin.value = sortedUserAdministrations.value[0]; }, { immediate: true }, );