Skip to content

Commit

Permalink
Merge pull request #386 from redlink-gmbh/Feature_MORE2-1_dynamic-stu…
Browse files Browse the repository at this point in the history
…dy-start

Bugfixes for Relative Events
  • Loading branch information
alireza-dhp authored Jan 8, 2024
2 parents 9e48937 + 87703df commit 5cfb7bd
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Gherkin Test: Bug fix relative scheduler (UTC time) and participant starting time

### Background:
- Study was created or exists and has a valid relative observation and 10 participants.

| **Scenario** | **Given** | **Steps** | **Expected Result** | **Result** | **Note** |
|---------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|-----------------------------------------------------|
| Participant list exists and updates | Background, and that a smartphone with the more app is prepared | <ul><li>WHEN I click on the participant tab, </li><li>And join the study as one of the participants </li></ul> | THEN the participants list should show a "started on" coloumn <br/>AND it should update with the correct starting date once the user data has been entered to the smartphone | as expected | After reload the startdate and time has been shown. |
| Relative scheduer shows the correct start and end times | Background, and the observation tab is open | <ul><li>WHEN I create a new observation</li><li>AND I add a relative scheduler</li><li>AND enter a valid start and end date</li><li>AND save the relative scheduler</li><li>AND fill in the needed data to save.</li><li>AND save the observation.</li></ul> | THEN the relative scheduler should show the correct start and end date (I have entered) at any given point during this test. | as expected | |
| The exported calendar shows the correct dates. | Background, and the study list is open. | <ul><li>WHEN I click the export study calendar button</li><li>AND I import the data to lokal calendar</li></ul> | THEN the existing observation(s) should be displayed correctly <br/>AND should not have a one hour offset compared to the observation(s) in the study manager | as expected | |
| Correct observation display on the smartphone | Background, one observation with a relative calendar exists with an start time of day one at 00:00 and an end time of 12:00<br/> AND it is repeated every day<br/>AND a mobile phone with the MORE app is ready to join the study <br/>AND the participant tab is open | <ul><li>WHEN I join the study on the mobile phone as one of the participants, which can have a relative observation take place,</li></ul> | THEN the observaions should be shown at the correct time, at the correct day. | as expected | |
5 changes: 5 additions & 0 deletions openapi/RelativeEvent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ components:
- MINUTE
- HOUR
- DAY

RelativeDate:
type: object
description: A date relative to a specific base date (e.g study start)
Expand All @@ -29,6 +30,10 @@ components:
type: string
format: time
description: Follows ISO 8601 format for time
timezone:
type: string
description: Time Zone string for relative event

RelativeRecurrenceRule:
type: object
description: A recurrence rule relative to dtstart
Expand Down
4 changes: 4 additions & 0 deletions openapi/StudyManagerAPI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,10 @@ components:
readOnly: true
status:
$ref: '#/components/schemas/ParticipantStatus'
start:
type: string
format: date-time
readOnly: true
created:
type: string
format: date-time
Expand Down
7 changes: 2 additions & 5 deletions src/components/ObservationList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Licensed under the Elastic License 2.0. */
import { useErrorHandling } from '../composable/useErrorHandling';
import DeleteMoreTableRowDialog from './dialog/DeleteMoreTableRowDialog.vue';
import dayjs from 'dayjs';
import { ZTimeStringToOffsetTimeString } from '../utils/dateUtils';
const loader = useLoader();
const { observationsApi } = useObservationsApi();
Expand Down Expand Up @@ -314,15 +313,13 @@ Licensed under the Elastic License 2.0. */
schedule.dtstart.offset?.unit
? `${t(
`scheduler.preview.unit.${schedule.dtstart.offset.unit}`
)} ${
schedule.dtstart.offset.value
}, ${ZTimeStringToOffsetTimeString(schedule.dtstart.time)}`
)} ${schedule.dtstart.offset.value}, ${schedule.dtstart.time}`
: undefined;
case 'dtend':
return schedule.dtend.offset?.value && schedule.dtend.offset?.unit
? `${t(`scheduler.preview.unit.${schedule.dtend.offset.unit}`)} ${
schedule.dtend.offset.value
}, ${ZTimeStringToOffsetTimeString(schedule.dtend.time)} `
}, ${schedule.dtend.time} `
: undefined;
default:
return undefined;
Expand Down
8 changes: 8 additions & 0 deletions src/components/ParticipantList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ Licensed under the Elastic License 2.0. */
placeholder: t('global.placeholder.noGroup'),
columnWidth: '15vw',
},
{
field: 'start',
header: t('participants.props.individualStart'),
type: MoreTableFieldType.datetime,
sortable: true,
placeholder: '-',
columnWidth: '10vw',
},
];
const rowActions: MoreTableAction[] = [
Expand Down
3 changes: 2 additions & 1 deletion src/components/shared/MoreTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,8 @@ Licensed under the Elastic License 2.0. */
{{ dayjs(data['__internalValue_' + field]).format('DD/MM/YYYY') }}
</span>
<span v-if="column.type === MoreTableFieldType.datetime">
<span v-if="data[field] !== '-'">
<span v-if="!data[field]"> - </span>
<span v-else-if="data[field] && data[field] !== '-'">
{{ dayjs(data[field]).format('DD/MM/YYYY, HH:mm') }}
</span>
<span v-else>
Expand Down
26 changes: 18 additions & 8 deletions src/components/shared/RelativeScheduler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import InputNumber from 'primevue/inputnumber';
import Dropdown from 'primevue/dropdown';
import Checkbox from 'primevue/checkbox';
import { ZTimeToOffsetTime } from '../../utils/dateUtils';
import {
RelativeEvent,
RelativeRecurrenceRule,
Expand All @@ -28,13 +27,15 @@
unit: schedule.dtstart?.offset?.unit,
},
time: schedule.dtstart?.time,
timezone: schedule.dtstart?.timezone,
},
dtend: {
offset: {
value: schedule.dtend?.offset?.value,
unit: schedule.dtend?.offset?.unit,
},
time: schedule.dtend?.time,
timezone: schedule.dtend?.timezone,
},
rrrule: {
frequency: {
Expand All @@ -56,7 +57,6 @@
parseInt(schedule.dtstart.time?.substring(0, 2)),
parseInt(schedule.dtstart.time?.substring(3, 5), 0)
);
startTime.value = ZTimeToOffsetTime(startTime.value);
} else {
startTime.value.setHours(10, 30);
}
Expand All @@ -65,14 +65,13 @@
parseInt(schedule.dtend.time?.substring(0, 2)),
parseInt(schedule.dtend.time?.substring(3, 5), 0)
);
endTime.value = ZTimeToOffsetTime(endTime.value);
} else {
endTime.value.setHours(18, 30);
}
returnSchedule.value.dtstart.time = returnSchedule.value.dtstart.time
? returnSchedule.value.dtstart.time
: '10:10';
: '10:00';
returnSchedule.value.dtend.time = returnSchedule.value.dtend.time
? returnSchedule.value.dtend.time
: '18:00';
Expand Down Expand Up @@ -250,15 +249,24 @@
function save() {
returnSchedule.value.dtstart.time = startTime.value
?.toISOString()
.substring(11, 16);
?.toTimeString()
.substring(0, 5);
returnSchedule.value.dtend.time = endTime.value
?.toISOString()
.substring(11, 16);
?.toTimeString()
.substring(0, 5);
returnSchedule.value.dtstart.offset = rDtstartOffset.value;
returnSchedule.value.dtend.offset = rDtendOffset.value;
if (typeof returnSchedule.value.dtstart.time !== 'undefined') {
returnSchedule.value.dtstart.timezone =
Intl.DateTimeFormat().resolvedOptions().timeZone;
}
if (typeof returnSchedule.value.dtend.time !== 'undefined') {
returnSchedule.value.dtend.timezone =
Intl.DateTimeFormat().resolvedOptions().timeZone;
}
if (repeatChecked.value) {
const rrrule: RelativeRecurrenceRule = {
frequency: rFrequency.value,
Expand Down Expand Up @@ -317,6 +325,7 @@
:placeholder="
$t('scheduler.dialog.relativeSchedule.placeholder.dtstartOffset')
"
:min="1"
@blur="calculatedRepeat()"
/>
</div>
Expand Down Expand Up @@ -350,6 +359,7 @@
:placeholder="
$t('scheduler.dialog.relativeSchedule.placeholder.dtendOffset')
"
:min="1"
@blur="calculatedRepeat()"
/>
</div>
Expand Down
7 changes: 2 additions & 5 deletions src/components/subComponents/SchedulerInfoBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Licensed under the Elastic License 2.0. */
import Button from 'primevue/button';
import { useI18n } from 'vue-i18n';
import dayjs from 'dayjs';
import { ZTimeStringToOffsetTimeString } from '../../utils/dateUtils';
const { t } = useI18n();
Expand Down Expand Up @@ -79,16 +78,14 @@ Licensed under the Elastic License 2.0. */
schedule.dtstart.offset?.unit
? `${t(
`scheduler.preview.unit.${schedule.dtstart.offset.unit}`
)} ${
schedule.dtstart.offset.value
}, ${ZTimeStringToOffsetTimeString(schedule.dtstart.time)}`
)} ${schedule.dtstart.offset.value}, ${schedule.dtstart.time}`
: undefined;
}
case 'dtend':
return schedule.dtend.offset?.value && schedule.dtend.offset?.unit
? `${t(`scheduler.preview.unit.${schedule.dtend.offset.unit}`)} ${
schedule.dtend.offset.value
}, ${ZTimeStringToOffsetTimeString(schedule.dtend.time)} `
}, ${schedule.dtend.time} `
: undefined;
default:
return undefined;
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@
"participantId": "Teilnehmer ID",
"alias": "Alias",
"token": "Token",
"registrationToken": "Registrierungstoken"
"registrationToken": "Registrierungstoken",
"individualStart": "Gestartet am"
},
"dialog": {
"header": {
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@
"participantId": "Participant ID",
"alias": "Alias",
"token": "Token",
"registrationToken": "Registration token"
"registrationToken": "Registration token",
"individualStart": "Started on"
},
"dialog": {
"header": {
Expand Down

0 comments on commit 5cfb7bd

Please sign in to comment.