From 8b656070cad0a6825b13beacf0ef933093028a26 Mon Sep 17 00:00:00 2001 From: Wolkenfarmer Date: Sun, 1 Sep 2024 15:04:01 +0200 Subject: [PATCH] #330 frontend: use enum for the exercise status --- .../screensPatient/ScreenWaiting.vue | 20 ++++++---------- .../widgets/ExerciseControlPanel.vue | 24 +++++++++---------- frontend/src/sockets/MessageData.ts | 10 +++++++- frontend/src/sockets/SocketPatient.ts | 8 +++---- frontend/src/sockets/SocketTrainer.ts | 12 +++++----- frontend/src/stores/Exercise.ts | 2 +- 6 files changed, 39 insertions(+), 37 deletions(-) diff --git a/frontend/src/components/screensPatient/ScreenWaiting.vue b/frontend/src/components/screensPatient/ScreenWaiting.vue index 59cd5bf3..c42cfeeb 100644 --- a/frontend/src/components/screensPatient/ScreenWaiting.vue +++ b/frontend/src/components/screensPatient/ScreenWaiting.vue @@ -8,13 +8,13 @@ const title = computed(() => { switch (exerciseStore.status) { - case 'running': + case ExerciseStatus.RUNNING: return patientStore.relocatingInfo - case 'not-started': + case ExerciseStatus.NOT_STARTED: return 'Warte, bis die Übung beginnt' - case 'paused': + case ExerciseStatus.PAUSED: return 'Übung pausiert' - case 'ended': + case ExerciseStatus.ENDED: return 'Übung beendet' default: return 'Warte auf Übung' @@ -22,15 +22,9 @@ }) const info = computed(() => { - switch (exerciseStore.status) { - case 'running': - return new Date(new Date(0).setSeconds(patientStore.timeUntilBack)).toISOString().substring(12, 19) - case 'not-started': - case 'paused': - case 'ended': - default: - return 'Bereich: '+ exerciseStore.getAreaName(patientStore.areaId) - } + if (exerciseStore.status == ExerciseStatus.RUNNING) { + return new Date(new Date(0).setSeconds(patientStore.timeUntilBack)).toISOString().substring(12, 19) + } else return 'Bereich: '+ exerciseStore.getAreaName(patientStore.areaId) }) diff --git a/frontend/src/components/widgets/ExerciseControlPanel.vue b/frontend/src/components/widgets/ExerciseControlPanel.vue index d200226b..3a087693 100644 --- a/frontend/src/components/widgets/ExerciseControlPanel.vue +++ b/frontend/src/components/widgets/ExerciseControlPanel.vue @@ -1,18 +1,18 @@