Skip to content

Commit

Permalink
Fix tasks loading (#883)
Browse files Browse the repository at this point in the history
* Fix SWR task loading

* Fix Vocab task loading

* Fix SRE task loading

* Fix Ran task loading

* Fix PA task loading

* Fix Multichoice task loading

* Fix MEP task loading

* Fix Levante task loading

* Fix Letter task loading

* Fix Fluency task loading

* Fix Crowding task loading
  • Loading branch information
maximilianoertel authored Oct 14, 2024
1 parent 4ec7be0 commit ab039e9
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 44 deletions.
11 changes: 7 additions & 4 deletions src/components/tasks/TaskCrowding.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions src/components/tasks/TaskFluency.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions src/components/tasks/TaskLetter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions src/components/tasks/TaskLevante.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions src/components/tasks/TaskMEP.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions src/components/tasks/TaskMultichoice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions src/components/tasks/TaskPA.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions src/components/tasks/TaskRan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions src/components/tasks/TaskSRE.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions src/components/tasks/TaskSWR.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions src/components/tasks/TaskVocab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ab039e9

Please sign in to comment.