-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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: Fixed multiple tickets error & refactored order invoice logic #6133
fix: Fixed multiple tickets error & refactored order invoice logic #6133
Conversation
39e12f3
to
c856375
Compare
Codecov Report
@@ Coverage Diff @@
## development #6133 +/- ##
============================================
Coverage 66.37% 66.37%
============================================
Files 286 286
Lines 14359 14359
============================================
Hits 9531 9531
Misses 4828 4828
Continue to review full report at Codecov.
|
Then you should filter by user_id as well. Current approach looks brittle, it'll just select first |
I agree. Changing it right now. |
The problem is that there is no user_id field associated with |
Let's say there are 3 OrderTicket associated with an order, meaning there are 3 tickets, then quantity of all 3 tickets can be different. Right? Even the price can be different |
Sorry for the confusion. The quantity will be different. I agree. The thing is, to represent each ticket with their quantity in a table in the order invoice, I had used OrderTicket Model. I will think of another approach. |
Then first will give wrong results, right? You need to loop over each ticket in OrderTicket relation |
Yes, just got that. I'm doing the same loop in Jinja template too. I'll
push it right away
…On Tue, 2 Jul 2019 at 3:21 PM, Areeb Jamal ***@***.***> wrote:
Let's say there are 3 OrderTicket associated with an order, meaning there
are 3 tickets, then quantity of all 3 tickets can be different. Right? Even
the price can be different
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#6133?email_source=notifications&email_token=AGAHUW2ARFV5LAJNOCTHP53P5MQLHA5CNFSM4H4YFXEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZAXGXQ#issuecomment-507605854>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGAHUW2XS2OTQNHICHAHFV3P5MQLHANCNFSM4H4YFXEA>
.
|
ab7380e
to
f7efb42
Compare
Add try except block for other cases
f7efb42
to
1010458
Compare
@iamareebjamal Refactored the jinja logic to match the OrderTicket loop too. |
Here's a test invoice |
Umm, there isn't a ticket attribute associated with it. Ticket_id, order_id
and quantity are the 3 attributes present in the model
…On Tue, 2 Jul 2019 at 4:34 PM, Areeb Jamal ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In app/templates/pdf/order_invoice.html
<#6133 (comment)>
:
> - <td style="text-align:center">{{ ticket.name }}</td>
- <td style="text-align:center">{{ event.payment_currency | currency_symbol }}{{ ticket.price }}</td>
- <td style="text-align:center">{{ order_tickets_info.quantity }}</td>
- <td style="text-align:center">{{ event.payment_currency | currency_symbol }}{{ order_tickets_info.quantity*ticket.price }}</td>
- {% if tax %}
- <td style="text-align:center">{{ tax.rate }}%</td>
- {% else %}
- <td style="text-align:center">{{ ("0%") }}</td>
- {% endif %}
- {% if tax %}
- <td style="text-align:center">{{ event.payment_currency | currency_symbol }}{{ tax.rate*ticket.price/100 }}</td>
- {% else %}
- <td style="text-align:center">{{ event.payment_currency | currency_symbol }}0</td>
- {% endif %}
- </tr>
+ {% for ticket in tickets %}
Why not just use order_ticket.ticket?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#6133?email_source=notifications&email_token=AGAHUWYNJB4WWT65OQDMDXTP5MY2TA5CNFSM4H4YFXEKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB5HMFFA#pullrequestreview-256819860>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGAHUWZHCOP6FU5EMECAFX3P5MY2TANCNFSM4H4YFXEA>
.
|
If there is ticket_id, there is ticket as related model |
cb03dcd
to
4d7ecbf
Compare
@iamareebjamal Oh yeah! SQLalchmey relations. I'm updating it right now. |
4d7ecbf
to
2697e29
Compare
Used order_ticket.ticket
2697e29
to
f26c422
Compare
Fixes #6132
Short description of what this resolves:
The order invoice function was trying to query for one entry alluding to the order ID. But, It found multiple entries pertaining to the order. Fixed this by taking only the first entry going into the model.
Changes proposed in this pull request:
OrderTicket
objectsChecklist
development
branch.