Subscription not loading products at term end date
Problem
Currently there is an inconsistency in subscription objects: on term end date, subscription from Subscription.subscription_on
will have main_product
as nil, and products
as empty array.
One thing to demonstrate this is to construct subscription via Order
, which has current_subscription
and subscription
. current_subscription
utilizes Subscription.subscription_on
, therefore does not return products. subscription
on the other hand would.
o=Order.where(end_date: Date.today).last
o.current_subscription.id == o.subscription.id # returns true, indicating they represent the same version
o.current_subscription.main_product
o.subscription.main_product
The above shows that the subscription objects should be the same, but one is without main_product.
Proposal
- Investigate the cause and if this is intended
- Fix the inconsistency
- Investigate if recovery is needed