From d55115d0ac02c8e7baf16085f9d641f2c2d72bb7 Mon Sep 17 00:00:00 2001 From: Padreug Date: Tue, 29 Sep 2026 08:28:48 +0200 Subject: [PATCH] feat(events): manage ticket waves from the organizer form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Capacity, price, currency and fiat edits made in the webapp were silently discarded. Since events ext v1.6.8 the backend derives those event-level fields FROM the waves on every write, so submitting a changed `amount_tickets` beside an unchanged wave list left the wave's old number winning. Verified against a running instance before fixing: 999 / 77 went in, 45 / 10.0 came back, HTTP 200. The dialog's price / capacity / currency fields ARE the primary wave, so they are now written into it on submit — the same write-through the LNbits admin dialog performs. A new "Ticket waves" section manages the tiers after the first, mirroring PromoCodesEditor: v-model over a row array, with the pure `validateWaveRows` so submit gates on exactly the rules the backend enforces. Validation follows `_validate_wave_capacity`, including its subtlety: a wave already stored on the event may sit at zero capacity, because that is what sold out looks like and rejecting it would make a sold-out event uneditable. Only a newly added wave must state a real capacity. Stored zeroes render as "Sold out" rather than as an error. One hazard found while wiring the write-through: on CREATE there is no stored event, so the implied primary wave was synthesized with empty date strings — which the backend then throws on for every read (`ValueError: Invalid isoformat string: ''`). The seed now supplies the same inputs `create_event` uses, so the wave the webapp sends matches the one the backend would have built. Pinned by a test. 72 tests; vue-tsc and prettier clean. --- .../events/components/CreateEventDialog.vue | 834 ++++++++++++------ .../events/components/TicketWavesEditor.vue | 195 ++++ src/modules/events/lib/ticketWaves.spec.ts | 101 +++ src/modules/events/lib/ticketWaves.ts | 66 ++ 4 files changed, 909 insertions(+), 287 deletions(-) create mode 100644 src/modules/events/components/TicketWavesEditor.vue diff --git a/src/modules/events/components/CreateEventDialog.vue b/src/modules/events/components/CreateEventDialog.vue index 7bd43a0..76a476a 100644 --- a/src/modules/events/components/CreateEventDialog.vue +++ b/src/modules/events/components/CreateEventDialog.vue @@ -1,17 +1,17 @@