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: Add max_quantity of ticket in order-statistics-event #6735
Conversation
app/models/event.py
Outdated
@@ -24,6 +24,7 @@ | |||
from app.models.ticket_fee import get_fee | |||
from app.models.ticket_fee import get_maximum_fee | |||
from app.models.ticket_holder import TicketHolder | |||
from app.models.order import Order, OrderTicket |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redefinition of unused 'Order' from line 18
app/api/order_statistics/events.py
Outdated
@@ -1,6 +1,6 @@ | |||
from flask_rest_jsonapi import ResourceDetail | |||
from marshmallow_jsonapi import fields | |||
from marshmallow_jsonapi.flask import Schema | |||
from marshmallow_jsonapi.flask import Schema, Relationship |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'marshmallow_jsonapi.flask.Relationship' imported but unused
Codecov Report
@@ Coverage Diff @@
## development #6735 +/- ##
===============================================
- Coverage 65.39% 65.26% -0.14%
===============================================
Files 300 300
Lines 15317 15357 +40
===============================================
+ Hits 10017 10023 +6
- Misses 5300 5334 +34
Continue to review full report at Codecov.
|
app/api/order_statistics/events.py
Outdated
tickets = fields.Str() | ||
orders = fields.Str() | ||
sales = fields.Str() | ||
# tickets = fields.Method("tickets_count") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iamareebjamal - How do i make the tickets
variable of dynamic type like
for when I want to work with GET call of
http://127.0.0.1:5000/v1/users/8/events?page[size]=0&include=order_statistics
the tickets should be of type fields.Dict()
and when I call GET http://127.0.0.1:5000/v1/events/38/order-statistics
it should call the function from events model and take that type.
Stucked here!
@codedsun Please complete this now |
Codecov Report
@@ Coverage Diff @@
## development #6735 +/- ##
==============================================
Coverage ? 65.42%
==============================================
Files ? 300
Lines ? 15330
Branches ? 0
==============================================
Hits ? 10030
Misses ? 5300
Partials ? 0
Continue to review full report at Codecov.
|
@iamareebjamal - Done check |
Does not filter deleted tickets out |
app/api/order_statistics/events.py
Outdated
@@ -48,14 +50,16 @@ def tickets_count(self, obj): | |||
Order.event_id == obj_id, Order.status == 'placed').scalar() | |||
completed = db.session.query(func.sum(OrderTicket.quantity.label('sum'))).join(Order.order_tickets).filter( | |||
Order.event_id == obj_id, Order.status == 'completed').scalar() | |||
max = db.session.query(func.sum(Ticket.quantity.label('sum'))).filter(Ticket.event_id == obj_id, Ticket.deleted_at == None).scalar() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comparison to None should be 'if cond is None:'
line too long (140 > 120 characters)
@@ -48,14 +50,17 @@ def tickets_count(self, obj): | |||
Order.event_id == obj_id, Order.status == 'placed').scalar() | |||
completed = db.session.query(func.sum(OrderTicket.quantity.label('sum'))).join(Order.order_tickets).filter( | |||
Order.event_id == obj_id, Order.status == 'completed').scalar() | |||
max = db.session.query(func.sum(Ticket.quantity.label('sum'))).filter(Ticket.event_id == obj_id, | |||
Ticket.deleted_at == None).scalar() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comparison to None should be 'if cond is None:'
@iamareebjamal - Chck this |
…ed order_statistics in event
Fixes #6710
feat: Add max_quantity of ticket in order-statistics-event
Short description of what this resolves:
Changes proposed in this pull request:
Checklist
development
branch.