Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Show "Free" instead of $0.00 in ticket price #5369

Merged
merged 8 commits into from
Nov 1, 2020

Conversation

sachinchauhan2889
Copy link
Contributor

Fixes #5364

Short description of what this resolves:

In the column "Price" and "Subtotal" for free tickets show "Free" instead of $0.00.

Changes proposed in this pull request:

-In the column "Price" and "Subtotal" for free tickets show "Free" instead of $0.00.

Checklist

  • I have read the Contribution & Best practices Guide.
  • My branch is up-to-date with the Upstream development branch.
  • The acceptance, integration, unit tests and linter pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

screenshots
before
5364 before

after
5364 resolved

@vercel
Copy link

vercel bot commented Oct 23, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/eventyay/open-event-frontend/p8leld8kn
✅ Preview: https://open-event-frontend-git-fix-5364.eventyay.vercel.app

@codecov
Copy link

codecov bot commented Oct 23, 2020

Codecov Report

Merging #5369 into development will decrease coverage by 0.05%.
The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #5369      +/-   ##
===============================================
- Coverage        22.78%   22.72%   -0.06%     
===============================================
  Files              491      491              
  Lines             5245     5245              
  Branches            37       37              
===============================================
- Hits              1195     1192       -3     
- Misses            4045     4048       +3     
  Partials             5        5              
Impacted Files Coverage Δ
app/models/event.js 31.25% <0.00%> (-18.75%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bbdbe76...e2d14b9. Read the comment docs.

Copy link
Member

@mariobehling mariobehling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Could you also make this work in the same way once the user presses "Order" and show "Free" on the next order page, please?

Screenshot from 2020-10-24 05-02-18

@sachinchauhan2889
Copy link
Contributor Author

@iamareebjamal @mariobehling implemented suggested changes.

newwwwwww

snitin315
snitin315 previously approved these changes Oct 24, 2020
Copy link
Member

@snitin315 snitin315 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Job!

{{t "Free"}}
{{else}}
{{currency-symbol this.eventCurrency}} {{format-money ticket.price}}
{{/if}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this an HTML only component to avoid repetition. Just move it into its own HTML file and replace ticket.type and ticket.price to @ticket.type and vice versa. Then use that component and pass ticket like @ticket={{ticket}}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name the component ticket-price.hbs

@iamareebjamal
Copy link
Member

@sachinchauhan2889 Status?

@sachinchauhan2889
Copy link
Contributor Author

@sachinchauhan2889 Status?

@iamareebjamal sir i will implement your suggested changes by tomorrow morning. Sorry for delay sir i was busy in my exam. I will surly commit changes suggested by you by tomorrow morning.

@iamareebjamal
Copy link
Member

No issues

@sachinchauhan2889
Copy link
Contributor Author

@iamareebjamal sir i have created a new component for solving this issue(as suggested by you).

123

456

import Component from '@ember/component';

@classic
export default class TicketPrice extends Component {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need of this file, please remove it

<Orders::TicketPrice
@ticket-type={{ticket.type}}
@display-symbol={{currency-symbol this.eventCurrency}}
@display-price={{format-money ticket.price}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply pass the ticket. What's the point of creating a component if you'll be doing all calculations here

@iamareebjamal
Copy link
Member

I have reviewed again. Please read my previous review again and what it is asking to do. You have used a significantly more complex solution

@sachinchauhan2889
Copy link
Contributor Author

sachinchauhan2889 commented Nov 1, 2020

@iamareebjamal sir, have a look at this. i have done calculations inside ticket-price.hbs. i passesd ticket as @ticket={{ticket}}.
For accessing eventCurrency and attendees inside ticket-price.hbs i have also passed them as parameter.
I have also passed a parameter named display which will decide what to display if ticket is not free.

{{currency-symbol @eventCurrency}} {{format-money @ticket.subTotal}}
{{else if (eq @display 'order-subTotal')}}
{{currency-symbol @eventCurrency}} {{format-money (mult (sub @ticket.price @ticket.discount) (ticket-attendees @attendees @ticket.attendees))}}
{{/if}}
Copy link
Member

@iamareebjamal iamareebjamal Nov 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you making it so so difficult? You just have to check the type and show either free or passed value. Pass the amount as an argument and don't do these complex calculations here. I don't know why everyone likes so much complicated solutions. Passing attendees and multiplying and switch casing. I don't know what to say except changing it myself will take much much less time than reviewing this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamareebjamal sorry sir.

@iamareebjamal
Copy link
Member

Please see the changes now

@sachinchauhan2889
Copy link
Contributor Author

@iamareebjamal sir, there is a misunderstanding between us. please look at my previous commits. i have given this solution. but u told me to do calculations inside ticket-price.hbs.
i only need to pass ticket as @ticket={{ticket}}.

newwwwwwwwwwwww

@iamareebjamal
Copy link
Member

Because you were formatting money and doing currency conversions here, which can be moved in the component. See the end result. Why would I ask you to write more code than you had written? Is the end result shorter than your version or not?

@sachinchauhan2889
Copy link
Contributor Author

Because you were formatting money and doing currency conversions here, which can be moved in the component. See the end result. Why would I ask you to write more code than you had written? Is the end result shorter than your version or not?

@iamareebjamal sir, yes you are right. I will take care of this from now.
now this is able to merge.
i have remove (or @amount @ticket.price) this because in subtotal column initially subtotal is 0 and price is non-zero. so initially subtotal column is showing ticket-price instead of $0.00

@iamareebjamal
Copy link
Member

i have remove (or @amount @ticket.price) this because in subtotal column initially subtotal is 0 and price is non-zero. so initially subtotal column is showing ticket-price instead of $0.00

OK, thank you

@iamareebjamal iamareebjamal changed the title fix: Public Event Page: Free Tickets - Show "Free" instead of $0.00 fix: Show "Free" instead of $0.00 in ticket price Nov 1, 2020
@iamareebjamal iamareebjamal merged commit 0f07185 into fossasia:development Nov 1, 2020
@sachinchauhan2889 sachinchauhan2889 deleted the fix-5364 branch November 3, 2020 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Public Event Page: Free Tickets - Show "Free" instead of $0.00
4 participants