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

feat: Ticket pre-selected for 1 type of tickets #5591

Merged
merged 7 commits into from
Nov 14, 2020
Merged

feat: Ticket pre-selected for 1 type of tickets #5591

merged 7 commits into from
Nov 14, 2020

Conversation

divyamtayal
Copy link
Member

Fixes #5449

Short description of what this resolves:

If there is only one ticket type , pre-select ticket with minOrder.

Changes proposed in this pull request:

  • For one type of ticket, minOrder of tickets is pre-selected
  • For minOrder of tickets pre-selected, Order now button is also working,
  • Also total and taxes are calulated before only showing that ticket is pre-selected.

BEFORE (no pre-select)

Screenshot from 2020-11-12 20-20-45

AFTER (pre-selected)

(for minOrder=0)
Screenshot from 2020-11-12 20-24-42
(for minOrder=3)
Screenshot from 2020-11-12 20-28-54

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)

@vercel
Copy link

vercel bot commented Nov 12, 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/jphv0zlb0
✅ Preview: https://open-event-frontend-git-ticket-pre-select-5449.eventyay.vercel.app

@divyamtayal
Copy link
Member Author

@iamareebjamal Please see the changes and implementation I have made.

@codecov
Copy link

codecov bot commented Nov 12, 2020

Codecov Report

Merging #5591 (397c1a5) into development (1017f3b) will decrease coverage by 0.00%.
The diff coverage is 20.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #5591      +/-   ##
===============================================
- Coverage        23.73%   23.73%   -0.01%     
===============================================
  Files              498      498              
  Lines             5270     5275       +5     
  Branches            47       47              
===============================================
+ Hits              1251     1252       +1     
- Misses            4011     4015       +4     
  Partials             8        8              
Impacted Files Coverage Δ
app/components/public/ticket-list.js 19.00% <20.00%> (+0.04%) ⬆️

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 1017f3b...397c1a5. Read the comment docs.

@@ -88,12 +88,19 @@
@id={{concat ticket.id "_quantity"}}
@value={{ticket.orderQuantity}} />
<i class="dropdown icon"></i>
<div class="default text">0</div>
<div class="default text">{{if (eq this.tickets.length 1) (if (gt ticket.minOrder 1) ticket.minOrder 1) 0}}</div>
Copy link
Member

Choose a reason for hiding this comment

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

Why the need of this logic now?

Copy link
Member Author

Choose a reason for hiding this comment

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

bcz we need to show if no of ticketes type is '1' and minOrer is 0 then it should be 1 else minOrder
we can improve this by

{{if (eq this.tickets.length 1) (max ticket.minOrder 1) 0}}

@divyamtayal
Copy link
Member Author

divyamtayal commented Nov 13, 2020

@iamareebjamal I have also fixed the bug which was coming when minOrder is 0 and types of tickets is more then 1,
so now it is working with every possible situation

BUG
Screenshot from 2020-11-13 13-40-54
showing 0 two times (fixed now)

@@ -88,10 +88,10 @@
@id={{concat ticket.id "_quantity"}}
@value={{ticket.orderQuantity}} />
<i class="dropdown icon"></i>
<div class="default text">0</div>
<div class="default text">{{if (eq this.tickets.length 1) (max ticket.minOrder 1) 0}}</div>
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't {{ticker.orderQuantity}} work here?

Copy link
Member Author

Choose a reason for hiding this comment

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

no bcz the value of ticket.orderQuantity is undefined intially and meantime the dom is rendered completely after that ticket.orderQuantity value is changed.

Copy link
Member Author

@divyamtayal divyamtayal Nov 13, 2020

Choose a reason for hiding this comment

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

but I think it should be working but its not. it is showing blank just bcz as i said above

Copy link
Member

Choose a reason for hiding this comment

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

{{or ticket.orderQuantity 0}}

Copy link
Member Author

@divyamtayal divyamtayal Nov 13, 2020

Choose a reason for hiding this comment

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

this will work OK for more then one type of tickets but in case of only 1 type of tickets still ticket.orderQuanitity is undefined so it will show 0 there also.
and I don't know why in this it is wokring correct

 <Input
    @type="hidden"
    @id={{concat ticket.id "_quantity"}}
    @value={{ticket.orderQuantity}} />

but not here

 <div class="default text">{{or ticket.orderQuanitity 0}}</div>

Copy link
Member Author

Choose a reason for hiding this comment

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

@iamareebjamal please let me know

@iamareebjamal iamareebjamal changed the title Ticket Pre-selected for 1 type of tickets feat: Ticket pre-selected for 1 type of tickets Nov 14, 2020
@auto-label auto-label bot added the feature label Nov 14, 2020
@iamareebjamal iamareebjamal merged commit 5ae084a into fossasia:development Nov 14, 2020
@divyamtayal divyamtayal deleted the ticket-pre-select-5449 branch November 15, 2020 17:52
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.

Ticket Order: If there is only one ticket type, please pre-select '1' instead of '0'
2 participants