Skip to content

Conversation

@mrsaicharan1
Copy link
Member

@mrsaicharan1 mrsaicharan1 commented Jun 25, 2019

Fixes #3184

When organizer tries to adds tickets worth of 0 value
Screenshot 2019-06-24 at 11 45 37 PM

When the ticket buyer tries to add zero valued donation tickets
Screenshot 2019-06-26 at 7 04 39 AM

Short description of what this resolves:

Does not allow donation tickets worth of 0 value to be purchased & adds quantity support

Changes proposed in this pull request:

  • Added quantity support for donation tickets
  • Removed duplicate code segment
  • Added check to prevent donation tickets whose value is 0

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)

@mrsaicharan1 mrsaicharan1 changed the title [WIP]fix: Donation tickets [WIP]fix:Adds quantity & prevents zero valued donation tickets Jun 25, 2019
@mrsaicharan1 mrsaicharan1 changed the title [WIP]fix:Adds quantity & prevents zero valued donation tickets [WIP]feat:Adds quantity & prevents zero valued donation tickets Jun 25, 2019
@mrsaicharan1
Copy link
Member Author

@CosmicCoder96 @niranjan94 @uds5501 @shreyanshdwivedi I was able to add support for quantity in donation tickets.
On the other hand, I've added validation checks and added a min & max attribute to the ticket price . But it's still allowing me to order with 0 price. Could you help me out here?

@kushthedude
Copy link
Member

@CosmicCoder96 @niranjan94 @uds5501 @shreyanshdwivedi I was able to add support for quantity in donation tickets.
On the other hand, I've added validation checks and added a min & max attribute to the ticket price . But it's still allowing me to order with 0 price. Could you help me out here?

Add a server validation for minimum number of tickets . @mrsaicharan1

@mrsaicharan1
Copy link
Member Author

mrsaicharan1 commented Jun 25, 2019

@CosmicCoder96 @niranjan94 @uds5501 @shreyanshdwivedi I was able to add support for quantity in donation tickets.
On the other hand, I've added validation checks and added a min & max attribute to the ticket price . But it's still allowing me to order with 0 price. Could you help me out here?

Add a server validation for minimum number of tickets . @mrsaicharan1

Yeah I figured that part out but now suppose I want to check if the order contains a donation ticket with amount given as zero and the following data is being sent to create an order, won't be able to check it as there is no ticket info going through.

{
  "data": {
    "attributes": {
      "payment-mode": "paypal",
      "country": "India",
      "status": "pending",
      "amount": "10",
      "order-notes": "example"
    },
    "type": "order",
    "relationships": {
      "attendees": {
        "data": [
          {
            "id": "1",
            "type": "attendee"
          }
        ]
      },
      "event": {
        "data": {
          "id": "1",
          "type": "event"
        }
      }
    }
  }
}

@mrsaicharan1 mrsaicharan1 changed the title [WIP]feat:Adds quantity & prevents zero valued donation tickets feat:Adds quantity & prevents zero valued donation tickets Jun 25, 2019
@auto-label auto-label bot added the feature label Jun 25, 2019
@mrsaicharan1 mrsaicharan1 changed the title feat:Adds quantity & prevents zero valued donation tickets [WIP]feat:Adds quantity & prevents zero valued donation tickets Jun 25, 2019
@auto-label auto-label bot removed the feature label Jun 25, 2019
@mrsaicharan1 mrsaicharan1 force-pushed the donation-tickets branch 2 times, most recently from 7f0b107 to bc4388b Compare June 25, 2019 06:48
@mrsaicharan1
Copy link
Member Author

mrsaicharan1 commented Jun 25, 2019

I've added a computed function which would disable the order now button if the ticket price for donations is 0. But there seems to be some error @shreyanshdwivedi @uds5501

@mrsaicharan1 mrsaicharan1 changed the title [WIP]feat:Adds quantity & prevents zero valued donation tickets feat:Adds quantity & prevents zero valued donation tickets Jun 25, 2019
@auto-label auto-label bot added the feature label Jun 25, 2019
@mrsaicharan1 mrsaicharan1 force-pushed the donation-tickets branch 3 times, most recently from 299fc6d to c08fdae Compare June 25, 2019 13:33
@mrsaicharan1 mrsaicharan1 changed the title feat:Adds quantity & prevents zero valued donation tickets [WIP]feat:Adds quantity & prevents zero valued donation tickets Jun 25, 2019
@auto-label auto-label bot removed the feature label Jun 25, 2019
@mrsaicharan1 mrsaicharan1 force-pushed the donation-tickets branch 2 times, most recently from ddcf947 to 9698259 Compare June 26, 2019 01:36
@mrsaicharan1 mrsaicharan1 changed the title [WIP]feat:Adds quantity & prevents zero valued donation tickets feat:Adds quantity & prevents zero valued donation tickets Jun 26, 2019
@auto-label auto-label bot added the feature label Jun 26, 2019
@mrsaicharan1 mrsaicharan1 force-pushed the donation-tickets branch 2 times, most recently from 55d7464 to 4d17ae2 Compare June 26, 2019 02:17
@mrsaicharan1
Copy link
Member Author

mrsaicharan1 commented Jun 26, 2019

I've changed the condition such that the donation price should be greater than the minimum price set for it by the organizer.

@mrsaicharan1
Copy link
Member Author

@mariobehling @CosmicCoder96 Please have a look at this.

@mrsaicharan1 mrsaicharan1 changed the title feat:Adds quantity & prevents zero valued donation tickets feat:Adds quantity support & prevents zero valued donation tickets Jun 26, 2019
Copy link
Contributor

@uds5501 uds5501 left a comment

Choose a reason for hiding this comment

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

LGTM

@mrsaicharan1 mrsaicharan1 force-pushed the donation-tickets branch 5 times, most recently from 2683d74 to 2bbfb4a Compare June 27, 2019 05:29
@mrsaicharan1
Copy link
Member Author

@CosmicCoder96 Updated with the min/max validation rule.Please review.

Copy link
Member

@pradeepgangwar pradeepgangwar left a comment

Choose a reason for hiding this comment

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

LGTM

@mrsaicharan1
Copy link
Member Author

mrsaicharan1 commented Jun 27, 2019

In the validation rule,

window.$.fn.form.settings.rules.checkMaxMin = () => {
	      let { tickets } = this.tickets;
	      for (let ticket of tickets) {
	        if ((ticket.minPrice <= ticket.maxPrice) && (ticket.minPrice > 0) && (ticket.maxPrice > 0)) {
	          return true;
	        }
	      }
	      return false;
	    };

when I use object structuring/destructuring, i.e let { tickets } = this.tickets; I get
checkMaxMin — basic-details-step.js:124TypeError: undefined is not an object (evaluating 'tickets[Symbol.iterator]') when I try to enter max/min values while creating new donation tickets

But when I just use let tickets = this.tickets; , It works perfectly.

Copy link
Member

@kushthedude kushthedude left a comment

Choose a reason for hiding this comment

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

@mrsaicharan1 This PR needs more modification see this images :

  • Unable to add Donation Tickets, Getting this error :
    image

  • When ever a donation ticket is added , Show payment options , It can happen if a event only has Free and Donation Tickets .

@kushthedude
Copy link
Member

kushthedude commented Jun 27, 2019

@mrsaicharan1 The Ticket Input is still broken in Orientation and UI:
image

Copy link
Member

@niranjan94 niranjan94 left a comment

Choose a reason for hiding this comment

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

when I use object structuring/destructuring, i.e let { tickets } = this.tickets


getValidationRules() {
window.$.fn.form.settings.rules.checkMaxMin = () => {
let { tickets } = this.tickets;
Copy link
Member

Choose a reason for hiding this comment

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

Incorrect.

Should be

let { tickets } = this;

But then, why do you even need to store it in a variable ? You can directly use this.tickets everywhere right ?

Copy link
Member Author

@mrsaicharan1 mrsaicharan1 Jun 27, 2019

Choose a reason for hiding this comment

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

@niranjan94 Yes, you're right. Will use it.

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.

Order Quantity for Donation Tickets Missing and Donation Ticket of 0 USD should not be possible / minimum amount not working

6 participants