From 63a73e8b7621dc27b20bbfd3eaedfe3ea2195836 Mon Sep 17 00:00:00 2001 From: adpat Date: Fri, 2 Feb 2024 10:46:28 +0100 Subject: [PATCH 1/2] Completed ghFixed the Bug where a relative end could be set before the relative start. Now it displays an error message. Additionally, the error messages for the relative schedule have been fixed and they display properly now. --- src/components/shared/RelativeScheduler.vue | 33 ++++++++++++++++++--- src/i18n/de.json | 3 +- src/i18n/en.json | 3 +- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/components/shared/RelativeScheduler.vue b/src/components/shared/RelativeScheduler.vue index bf6ab58e..936ac912 100644 --- a/src/components/shared/RelativeScheduler.vue +++ b/src/components/shared/RelativeScheduler.vue @@ -13,6 +13,7 @@ } from '../../generated-sources/openapi'; import { useI18n } from 'vue-i18n'; import { MoreTableChoice } from '../../models/MoreTableModel'; + import {expectTypeOf} from "vitest"; const { t } = useI18n(); const dialogRef: any = inject('dialogRef'); @@ -151,7 +152,7 @@ ) { errors.value.push({ label: 'dtstart', - value: t('schedule.relativeSchedule.error.dtstart.addOffset'), + value: t('scheduler.dialog.relativeSchedule.error.dtstart.addOffset'), }); } if ( @@ -160,7 +161,31 @@ ) { errors.value.push({ label: 'dtend', - value: t('schedule.relativeSchedule.error.dtend.addOffset'), + value: t('scheduler.dialog.relativeSchedule.error.dtend.addOffset'), + }); + } + if ( + returnSchedule.value.dtend.offset?.value && + returnSchedule.value.dtstart.offset?.value && + returnSchedule.value.dtstart.offset?.value > + returnSchedule.value.dtend.offset?.value + ) { + errors.value.push({ + label: 'dtend', + value: t('scheduler.dialog.relativeSchedule.error.dtend.EndBeforeStart'), + }); + } + if ( + returnSchedule.value.dtstart.time && + returnSchedule.value.dtend.time && + (returnSchedule.value.dtstart.offset?.value == + returnSchedule.value.dtend.offset?.value) && + returnSchedule.value.dtstart.time >= + returnSchedule.value.dtend.time + ) { + errors.value.push({ + label: 'dtend', + value: t('scheduler.dialog.relativeSchedule.error.dtend.EndBeforeStart'), }); } if (repeatChecked.value) { @@ -170,7 +195,7 @@ ) { errors.value.push({ label: 'rrruleFreq', - value: t('schedule.relativeSchedule.error.rrrule.frequency'), + value: t('scheduler.dialog.relativeSchedule.error.rrrule.frequency'), }); } if ( @@ -179,7 +204,7 @@ ) { errors.value.push({ label: 'rrruleEndAfter', - value: t('schedule.relativeSchedule.error.rrrule.endAfter'), + value: t('scheduler.dialog.relativeSchedule.error.rrrule.endAfter'), }); } if (frequencyXTimes.value && frequencyXTimes.value <= 0) { diff --git a/src/i18n/de.json b/src/i18n/de.json index 7f5693ce..594c005c 100644 --- a/src/i18n/de.json +++ b/src/i18n/de.json @@ -941,7 +941,8 @@ "addOffset": "Befülle den Offset des relativen Startzeitraum." }, "dtend": { - "addOffset": "Befülle den Offset des relativen Endzeitraum." + "addOffset": "Befülle den Offset des relativen Endzeitraum.", + "EndBeforeStart": "Bitte setzen Sie den relativen Startzeitpunkt vor dem Endzeitpunkt" }, "rrrule": { "frequency": "Fülle die Widerholungsrate ein.", diff --git a/src/i18n/en.json b/src/i18n/en.json index 704c5f45..9b051c70 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -944,7 +944,8 @@ "addOffset": "Fill in the offset of the relative start period." }, "dtend": { - "addOffset": "Fill in the offset of the relative end period." + "addOffset": "Fill in the offset of the relative end period.", + "EndBeforeStart": "Please Set the relative start period before the end period" }, "rrrule": { "frequency": "Fill in the repetition rate.", From 1389552d912ce3b761b93cdee20caa9d34c1068d Mon Sep 17 00:00:00 2001 From: adpat Date: Fri, 2 Feb 2024 10:56:44 +0100 Subject: [PATCH 2/2] Forgot to run lint: fix. That has been done now as well --- src/components/shared/RelativeScheduler.vue | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/shared/RelativeScheduler.vue b/src/components/shared/RelativeScheduler.vue index 936ac912..d8916738 100644 --- a/src/components/shared/RelativeScheduler.vue +++ b/src/components/shared/RelativeScheduler.vue @@ -13,7 +13,6 @@ } from '../../generated-sources/openapi'; import { useI18n } from 'vue-i18n'; import { MoreTableChoice } from '../../models/MoreTableModel'; - import {expectTypeOf} from "vitest"; const { t } = useI18n(); const dialogRef: any = inject('dialogRef'); @@ -168,24 +167,27 @@ returnSchedule.value.dtend.offset?.value && returnSchedule.value.dtstart.offset?.value && returnSchedule.value.dtstart.offset?.value > - returnSchedule.value.dtend.offset?.value + returnSchedule.value.dtend.offset?.value ) { errors.value.push({ label: 'dtend', - value: t('scheduler.dialog.relativeSchedule.error.dtend.EndBeforeStart'), + value: t( + 'scheduler.dialog.relativeSchedule.error.dtend.EndBeforeStart' + ), }); } if ( returnSchedule.value.dtstart.time && returnSchedule.value.dtend.time && - (returnSchedule.value.dtstart.offset?.value == - returnSchedule.value.dtend.offset?.value) && - returnSchedule.value.dtstart.time >= - returnSchedule.value.dtend.time + returnSchedule.value.dtstart.offset?.value === + returnSchedule.value.dtend.offset?.value && + returnSchedule.value.dtstart.time >= returnSchedule.value.dtend.time ) { errors.value.push({ label: 'dtend', - value: t('scheduler.dialog.relativeSchedule.error.dtend.EndBeforeStart'), + value: t( + 'scheduler.dialog.relativeSchedule.error.dtend.EndBeforeStart' + ), }); } if (repeatChecked.value) {