Skip to content

Conversation

@liveHarshit
Copy link
Member

Fixes #2120

@mariobehling
Copy link
Member

Thanks. Please also provide an example for countries where tax is included in the price. Check how this works in Europe on Eventbrite for example and also check the frontend, please.

@liveHarshit
Copy link
Member Author

Thanks. Please also provide an example for countries where tax is included in the price. Check how this works in Europe on Eventbrite for example and also check the frontend, please.

Yes, I have checked on the frontend. It is according to organizer preference and all information are fetching from the server.
image
image

val code = appliedDiscountCode
tickets.forEach { ticket ->
var price = ticket.price
totalTaxAmount += (ticket.price * taxRate / 100) * qty[index]
Copy link
Member

Choose a reason for hiding this comment

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

Why are we not using it.second instead of maintaining an index?

Copy link
Member Author

Choose a reason for hiding this comment

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

it is nothing here. We are fetching the list of tickets and qty stored in an array.

Copy link
Member

Choose a reason for hiding this comment

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

Why not use ticketAndQty?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think so. It's quite complex. Will try 👍

Copy link
Member

Choose a reason for hiding this comment

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

It's not. it was created exactly so that index can be avoided

Copy link
Member

Choose a reason for hiding this comment

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

No, it is a list of pair. So you iterate over it without the need of index

Copy link
Member Author

Choose a reason for hiding this comment

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

Iterating is already used on a list of tickets which is getting from the database for the ticket price. So for this, two parallel iterators are required.

Copy link
Member

Choose a reason for hiding this comment

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

Don't use tickets for iteration, use ticketAndQty, that's why it was created by @anhanh11001

Copy link
Member Author

Choose a reason for hiding this comment

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

Well then ticketAndQty doesn't have the ticket price

E/TicketsViewModel: (47, 1, 0.0)
E/TicketsViewModel: (48, 2, 0.0)

So here we need to fetch selected tickets to get price. Only donation tickets have price at third place in ticketAndQty.

Copy link
Member

Choose a reason for hiding this comment

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

Merging, but open an issue to either use or remove ticketAndQty

Copy link
Contributor

@anhanh11001 anhanh11001 left a comment

Choose a reason for hiding this comment

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

Rest looks good to me

}
}
price.let { prices += price * qty[index++] }
price.let { prices += price * qty[index] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not unnecessary, the index is updated at the end.

@iamareebjamal iamareebjamal merged commit e207a98 into fossasia:development Jul 30, 2019
liveHarshit added a commit to liveHarshit/open-event-attendee-android that referenced this pull request Aug 11, 2019
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.

Fetch tex price details

5 participants