From bef3aca2079b5caecc8b512e45adf0c75ff7a070 Mon Sep 17 00:00:00 2001 From: Qiyun Dai Date: Wed, 23 Oct 2024 10:56:06 -0500 Subject: [PATCH] [MWPW-160931] Don't save unfinished agenda (#260) --- .../controllers/event-agenda-component-controller.js | 2 +- ecc/components/agenda-fieldset-group/agenda-fieldset-group.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ecc/blocks/form-handler/controllers/event-agenda-component-controller.js b/ecc/blocks/form-handler/controllers/event-agenda-component-controller.js index 59759f2d..097c77d2 100644 --- a/ecc/blocks/form-handler/controllers/event-agenda-component-controller.js +++ b/ecc/blocks/form-handler/controllers/event-agenda-component-controller.js @@ -7,7 +7,7 @@ export function onSubmit(component, props) { let agenda = []; - if (agendaGroup) agenda = agendaGroup.getAgendas(); + if (agendaGroup) agenda = agendaGroup.getCompleteAgenda(); const agendaInfo = { showAgendaPostEvent, diff --git a/ecc/components/agenda-fieldset-group/agenda-fieldset-group.js b/ecc/components/agenda-fieldset-group/agenda-fieldset-group.js index 598074e2..5ded6fe3 100644 --- a/ecc/components/agenda-fieldset-group/agenda-fieldset-group.js +++ b/ecc/components/agenda-fieldset-group/agenda-fieldset-group.js @@ -40,8 +40,8 @@ export default class AgendaFieldsetGroup extends LitElement { this.agendaItems = this.agendaItems.map((agenda, i) => (i === index ? updatedAgenda : agenda)); } - getAgendas() { - return this.agendaItems.filter((o) => !(Object.keys(o).length === 0 && o.constructor === Object)); + getCompleteAgenda() { + return this.agendaItems.filter((o) => (o.startTime && o.description)); } hasOnlyEmptyAgendaLeft() {