The three premium sources: how each works, who controls each, and what happens when they overlap.
Premium tier comes from one of three independent sources,
recorded in UserProfile.premium_source:
direct_payment: the athlete paid the $49 / yr fee
themselves.coach_grant: a coach is comping the athlete.admin_grant: a Yousuli admin granted it (beta period,
sponsorship).yousuli_co_sync: legacy import from the marketing site.The role flip to premium_athlete is the same regardless of
source. What differs is who controls it, how long it lasts,
and what happens when other things change.
/settings/billing/.premium_until: today + 365 days at purchase, then
renews annually.premium_granted_by: NULL (no granter).premium_until: typically set to the coach's
billing_until (i.e. while the coach has paid access).
Can be shorter if the coach revokes early.premium_granted_by: the coach's user record.premium_until: whatever date the admin sets,
typically tied to a beta period or sponsorship contract.premium_granted_by: the admin's user record.premium_until
passes.If multiple sources would apply (e.g. coach grant plus
direct payment), only one is recorded in premium_source at
a time. The system uses the most recently set source.
When deciding what to do on an event (coach revokes, relationship ends, etc.), the system checks the recorded source:
premium_source = 'coach_grant' and that coach revokes
or the relationship ends, premium ends.premium_source = 'direct_payment' and the coach
revokes their grant, nothing changes, because the
recorded source is the direct payment, not the coach
grant.This is why an athlete who pays directly is insulated from any coach change.
premium_until consistent with the grant intent.See also: Free vs Premium athlete, Granting premium access, Switching coaches explained, Billing and subscription.
Still stuck? Ask us a question and we'll write up an answer.
Ask a question