Fakultas Ilmu Komputer UI

Commit f1df7b78 authored by Glenda Emanuella Sutanto's avatar Glenda Emanuella Sutanto
Browse files

Merge branch 'hotfix' into 'staging'

Add new variable to mark if something (cart) is paid

See merge request !90
parents cbf0f5fc 70be2a21
Pipeline #84197 passed with stages
in 17 minutes and 25 seconds
......@@ -26,21 +26,27 @@ class UserAuthSerializer(serializers.ModelSerializer):
result['transaction_status'] = None
result['cart_id'] = None
result['all_carts_are_expired'] = None
result['all_carts_are_expired'] = False
if instance.cart.exists():
result['transaction_status'] = instance.cart.last().transaction_status
result['cart_id'] = instance.cart.last().id
something_is_paid = False
all_carts_are_expired = True
for cart in instance.cart.all():
if cart.program_end_date is None:
something_is_paid = True
if cart.program_end_date >= datetime.date.today():
all_carts_are_expired = False
result['all_carts_are_expired'] = all_carts_are_expired
if not something_is_paid:
result['all_carts_are_expired'] = False
result['all_carts_are_expired'] = all_carts_are_expired
result['nutritionist'] = None
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment