From d1d55bdbd7927a299bbf55f2baf6875cd848980f Mon Sep 17 00:00:00 2001 From: Ben Bonfil Date: Fri, 15 Nov 2024 15:38:28 +0100 Subject: [PATCH] Feature/integer duration (#238) * changed experiment duration from free-text field to minutes (integer) * appointment end should be determined by start + duration * appeasing the linter * computed end time in AppointmentForm + updated tests --- babex-vue/src/api.ts | 1 - .../src/components/agenda/AgendaCalendar.vue | 6 +- .../src/components/agenda/AppointmentForm.vue | 10 +-- babex-vue/src/components/invite/CallHome.vue | 20 +++--- integration_tests/test_invite.py | 17 +++-- lab/agenda/views.py | 2 +- lab/conftest.py | 2 +- lab/experiments/email.py | 4 +- lab/experiments/forms/experiment_forms.py | 2 - .../locale/en/LC_MESSAGES/django.po | 5 +- .../locale/nl/LC_MESSAGES/django.po | 5 +- ..._experiment_confirmation_email_and_more.py | 33 +++++++++ lab/experiments/models/appointment_models.py | 10 ++- lab/experiments/models/experiment_models.py | 4 +- lab/experiments/serializers.py | 7 +- lab/experiments/templates/call/home.html | 4 +- .../experiments/detail_parts/info.html | 4 +- lab/experiments/test_exclusion.py | 70 ++++++++++++------- lab/experiments/test_views.py | 8 +-- lab/experiments/views/call_views.py | 5 +- lab/integration_tests/conftest.py | 5 +- lab/integration_tests/test_agenda.py | 14 ---- lab/integration_tests/test_experiments.py | 4 +- parent/parent/templates/parent/overview.html | 2 +- 24 files changed, 145 insertions(+), 99 deletions(-) create mode 100644 lab/experiments/migrations/0023_alter_experiment_confirmation_email_and_more.py diff --git a/babex-vue/src/api.ts b/babex-vue/src/api.ts index 3ac63e92..0b8f9781 100644 --- a/babex-vue/src/api.ts +++ b/babex-vue/src/api.ts @@ -217,7 +217,6 @@ class GenericApiPart extends ApiPart { interface AppointmentCreate { start: Date, - end: Date, experiment: number, leader: number, participant: number, diff --git a/babex-vue/src/components/agenda/AgendaCalendar.vue b/babex-vue/src/components/agenda/AgendaCalendar.vue index ed895e25..1d229fc8 100644 --- a/babex-vue/src/components/agenda/AgendaCalendar.vue +++ b/babex-vue/src/components/agenda/AgendaCalendar.vue @@ -20,7 +20,7 @@ // optional experiment id for limiting feeds experiment?: number, - scheduling?: boolean, + duration?: number, }>(); // from https://stackoverflow.com/a/64090995 @@ -130,7 +130,9 @@ allDaySlot: false, slotMinTime: "07:00:00", slotMaxTime: "20:00:00", - slotDuration: props.scheduling ? "00:15:00" : "00:30:00", + slotDuration: {minutes: props.duration ?? 30}, + defaultTimedEventDuration: {minutes: props.duration}, + forceEventDuration: props.duration ? true : false, eventTimeFormat: { hour: '2-digit', minute: '2-digit', diff --git a/babex-vue/src/components/agenda/AppointmentForm.vue b/babex-vue/src/components/agenda/AppointmentForm.vue index 7c9ee271..75cf35be 100644 --- a/babex-vue/src/components/agenda/AppointmentForm.vue +++ b/babex-vue/src/components/agenda/AppointmentForm.vue @@ -1,5 +1,5 @@