Move community program helper methods to subscription instance
Problem
As per this comment, we have couple of helper methods for community programs (Plan.community_edu_oss_plan?(subscription.plan&.id)
and Plan.community_program_plan_type(subscription.plan&.id)
which can be moved to the subscription instance so that they can be used by other models too.
Proposal
Move the 2 methods (Plan.community_edu_oss_plan?(subscription.plan&.id)
and Plan.community_program_plan_type(subscription.plan&.id)
) to subscription instance. Can be moved to the RatePlanHelper
concern.
rate_plan_helper.rb
def community_edu_oss_plan?
Plan.community_edu_oss_plan?(product_rate_plan_id)
end
def community_program_plan_type
Plan.community_program_plan_type(product_rate_plan_id)
end
subscription_presenter.rb
community_edu_oss_plan: subscription.community_edu_oss_plan?,
community_program_plan_type: subscription.community_program_plan_type
Result
Next steps (if any)
How will we measure success?
Edited by Sharmad Nachnolkar