Skip to content

Commit ddcf947

Browse files
committed
Added watched properties and fixed totalling error
Added watched properties
1 parent df047e5 commit ddcf947

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

app/components/public/ticket-list.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export default Component.extend(FormMixin, {
1515
&& !this.get('authManager.currentUser.isVerified');
1616
}),
1717

18-
shouldDisableOrderButton: computed('hasTicketsInOrder', 'donationPriceValid', function() {
19-
return !this.hasTicketsInOrder || !this.donationPriceValid;
18+
shouldDisableOrderButton: computed('hasTicketsInOrder', 'isDonationPriceValid', function() {
19+
return !(this.hasTicketsInOrder && this.isDonationPriceValid);
2020
}),
2121

2222
showTaxIncludedMessage: computed('taxInfo.isTaxIncludedInPrice', function() {
@@ -40,23 +40,22 @@ export default Component.extend(FormMixin, {
4040
) > 0;
4141
}),
4242

43-
donationTickets: computed('tickets', function() {
44-
return this.tickets.filterBy('type', 'donation');
43+
donationTickets: computed('data', function() {
44+
return this.data.filterBy('type', 'donation');
4545
}),
4646

4747
isDonationPriceValid: computed('donationTickets', '[email protected]', '[email protected]', function() {
48-
if (this.donationTickets) {
49-
this.donationTickets.forEach(donationTicket => {
50-
if (donationTicket.orderQuantity >= 0) {
51-
if (donationTicket.price > 0) {
52-
return true;
53-
} else {
54-
return false;
55-
}
48+
let returnValue = false;
49+
this.donationTickets.forEach(donationTicket => {
50+
if (donationTicket.get('orderQuantity') >= 0) {
51+
if (donationTicket.get('price') > 0) {
52+
returnValue = true;
53+
} else {
54+
returnValue = false;
5655
}
57-
});
58-
}
59-
return true;
56+
}
57+
});
58+
return returnValue;
6059
}),
6160

6261
total: computed('[email protected]', '[email protected]', function() {

app/templates/components/public/ticket-list.hbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
{{else}}
4949
<td id="{{ticket.id}}_price">
5050
{{#if (eq ticket.type 'donation') }}
51-
<div class="field">
52-
{{input type='number' name="price" placeholder=(t 'Enter Donation') value=ticket.price min=ticket.minPrice max=ticket.maxPrice }}
53-
</div>
51+
<div class="field">
52+
{{input type='number' name="price" placeholder=(t 'Enter Donation') min=ticket.minPrice max=ticket.maxPrice value=ticket.price}}
53+
</div>
5454
{{else}}
5555
{{currency-symbol eventCurrency}} {{format-number ticket.price}}
5656
{{/if}}

0 commit comments

Comments
 (0)