@@ -123,23 +123,23 @@ export default Component.extend(FormMixin, {
123123 this . set ( 'invalidPromotionalCode' , true ) ;
124124 }
125125 try {
126- let discountCode = await this . store . queryRecord ( 'discount-code' , { eventIdentifier : this . event . id , code : this . promotionalCode } ) ;
127- let discountCodeEvent = await discountCode . get ( ' event' ) ;
126+ const discountCode = await this . store . queryRecord ( 'discount-code' , { eventIdentifier : this . event . id , code : this . promotionalCode , include : 'event,tickets' } ) ;
127+ const discountCodeEvent = await discountCode . event ;
128128 if ( this . currentEventIdentifier === discountCodeEvent . identifier ) {
129- let discountType = discountCode . get ( ' type' ) ;
130- let discountValue = discountCode . get ( ' value' ) ;
129+ const discountType = discountCode . type ;
130+ const discountValue = discountCode . value ;
131131 this . order . set ( 'discountCode' , discountCode ) ;
132- let tickets = await discountCode . get ( ' tickets' ) ;
132+ const tickets = await discountCode . tickets ;
133133 tickets . forEach ( ticket => {
134- let ticketPrice = ticket . get ( ' price' ) ;
135- let taxRate = ticket . get ( 'event.tax.rate' ) ;
136- let discount = discountType === 'amount' ? Math . min ( ticketPrice , discountValue ) : ticketPrice * ( discountValue / 100 ) ;
134+ const ticketPrice = ticket . price ;
135+ const taxRate = ticket . get ( 'event.tax.rate' ) ;
136+ const discount = discountType === 'amount' ? Math . min ( ticketPrice , discountValue ) : ticketPrice * ( discountValue / 100 ) ;
137137 ticket . set ( 'discount' , discount ) ;
138138 if ( taxRate && ! this . showTaxIncludedMessage ) {
139- let ticketPriceWithTax = ( ticketPrice - ticket . discount ) * ( 1 + taxRate / 100 ) ;
139+ const ticketPriceWithTax = ( ticketPrice - ticket . discount ) * ( 1 + taxRate / 100 ) ;
140140 ticket . set ( 'ticketPriceWithTax' , ticketPriceWithTax ) ;
141141 } else if ( taxRate && this . showTaxIncludedMessage ) {
142- let includedTaxAmount = ( taxRate * ( ticketPrice - discount ) ) / ( 100 + taxRate ) ;
142+ const includedTaxAmount = ( taxRate * ( ticketPrice - discount ) ) / ( 100 + taxRate ) ;
143143 ticket . set ( 'includedTaxAmount' , includedTaxAmount ) ;
144144 }
145145 this . discountedTickets . addObject ( ticket ) ;
0 commit comments