Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions app/components/public/ticket-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default Component.extend(FormMixin, {
total: computed('[email protected]', '[email protected]', '[email protected]', function() {
if (this.taxInfo !== null) {
return sumBy(this.tickets.toArray(),
ticket => (ticket.ticketPriceWithTax || 0) * (ticket.orderQuantity || 0)
ticket => ((ticket.ticketPriceWithTax || 0) - (ticket.discount || 0)) * (ticket.orderQuantity || 0)
);
}
return sumBy(this.tickets.toArray(),
Expand Down Expand Up @@ -123,9 +123,7 @@ export default Component.extend(FormMixin, {
this.set('invalidPromotionalCode', true);
}
try {
let discountCode = await this.store.findRecord('discount-code', this.promotionalCode, {
include: 'tickets'
});
let discountCode = await this.store.queryRecord('discount-code', { eventIdentifier: this.event.id, code: this.promotionalCode });
let discountCodeEvent = await discountCode.get('event');
if (this.currentEventIdentifier === discountCodeEvent.identifier) {
let discountType = discountCode.get('type');
Expand All @@ -151,6 +149,7 @@ export default Component.extend(FormMixin, {
this.set('invalidPromotionalCode', true);
}
} catch (e) {
console.warn(e);
if (this.invalidPromotionalCode) {
this.set('invalidPromotionalCode', true);
}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/public/ticket-list.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
</td>
<td id='{{ticket.id}}_subtotal' class="ui right aligned">
{{#if taxInfo}}
{{currency-symbol eventCurrency}} {{format-number (mult ticket.ticketPriceWithTax ticket.orderQuantity)}}
{{currency-symbol eventCurrency}} {{format-number (mult (sub ticket.ticketPriceWithTax ticket.discount) ticket.orderQuantity)}}
{{else}}
{{currency-symbol eventCurrency}} {{format-number (mult (sub ticket.price ticket.discount) ticket.orderQuantity)}}
{{/if}}
Expand Down