From 52e69bb2a3fba94e51211487f9737c6c5ed90804 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 20 Oct 2021 11:49:55 +0200 Subject: [PATCH] Fix event options being undefined in event view Signed-off-by: Thomas Citharel --- js/src/views/Event/Event.vue | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/js/src/views/Event/Event.vue b/js/src/views/Event/Event.vue index b30adfeba..48991bdad 100755 --- a/js/src/views/Event/Event.vue +++ b/js/src/views/Event/Event.vue @@ -135,17 +135,17 @@ }" > - + {{ $tc( "{available}/{capacity} available places", - event.options.maximumAttendeeCapacity - + maximumAttendeeCapacity - event.participantStats.participant, { available: - event.options.maximumAttendeeCapacity - + maximumAttendeeCapacity - event.participantStats.participant, - capacity: event.options.maximumAttendeeCapacity, + capacity: maximumAttendeeCapacity, } ) }} @@ -163,17 +163,17 @@ - + {{ $tc( "{available}/{capacity} available places", - event.options.maximumAttendeeCapacity - + maximumAttendeeCapacity - event.participantStats.participant, { available: - event.options.maximumAttendeeCapacity - + maximumAttendeeCapacity - event.participantStats.participant, - capacity: event.options.maximumAttendeeCapacity, + capacity: maximumAttendeeCapacity, } ) }} @@ -1074,20 +1074,23 @@ export default class Event extends EventMixin { : this.event.beginsOn; } + get maximumAttendeeCapacity(): number { + return this.event?.options?.maximumAttendeeCapacity; + } + get eventCapacityOK(): boolean { if (this.event.draft) return true; - if (!this.event.options.maximumAttendeeCapacity) return true; + if (!this.maximumAttendeeCapacity) return true; return ( - this.event.options.maximumAttendeeCapacity > + this.event?.options?.maximumAttendeeCapacity > this.event.participantStats.participant ); } get numberOfPlacesStillAvailable(): number { - if (this.event.draft) return this.event.options.maximumAttendeeCapacity; + if (this.event.draft) return this.maximumAttendeeCapacity; return ( - this.event.options.maximumAttendeeCapacity - - this.event.participantStats.participant + this.maximumAttendeeCapacity - this.event.participantStats.participant ); }