Skip to content

Commit

Permalink
fix: update scheduler time constraint for pending tickets
Browse files Browse the repository at this point in the history
ensure placed orders get notifications/mails/completed_at update too
  • Loading branch information
shreyanshdwivedi committed May 18, 2019
1 parent 215b471 commit 98ea0f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/api/helpers/scheduled_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,6 @@ def expire_pending_tickets_after_one_day():
from app import current_app as app
with app.app_context():
db.session.query(Order).filter(Order.status == 'pending',
(datetime.datetime.today() - Order.created_at).days > 1).\
(datetime.datetime.today() - Order.created_at).days > 3).\
update({'status': 'expired'})
db.session.commit()
4 changes: 2 additions & 2 deletions app/api/orders.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def after_create_object(self, order, data, view_kwargs):
# TicketingManager.calculate_update_amount(order)

# send e-mail and notifications if the order status is completed
if order.status == 'completed':
if order.status == 'completed' or order.status == 'placed':
if order.payment_mode in ['free', 'bank', 'cheque', 'onsite']:
order.completed_at = datetime.utcnow()
send_email_to_attendees(order, current_user.id)
Expand Down Expand Up @@ -309,7 +309,7 @@ def after_update_object(self, order, data, view_kwargs):
# delete the attendees so that the tickets are unlocked.
delete_related_attendees_for_order(order)

elif order.status == 'completed':
elif order.status == 'completed' or order.status == 'placed':
if order.payment_mode in ['free', 'bank', 'cheque', 'onsite']:
order.completed_at = datetime.utcnow()
send_email_to_attendees(order, current_user.id)
Expand Down

0 comments on commit 98ea0f3

Please sign in to comment.