-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add check to which plan the org is changing when applying the credits #1574
Changes from 3 commits
89b4496
9457691
8c36c62
01b4dd1
ef116a3
b3af21d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -189,6 +189,18 @@ | |||||||
$: selectedOrg = $organizationList?.teams?.find( | ||||||||
(team) => team.$id === selectedOrgId | ||||||||
) as Organization; | ||||||||
|
||||||||
function getNewBillingPlan(organization: Organization): BillingPlan { | ||||||||
if (organization?.billingPlan === BillingPlan.SCALE) { | ||||||||
return BillingPlan.SCALE; | ||||||||
} else if (campaign?.plan) { | ||||||||
return campaign.plan; | ||||||||
} else { | ||||||||
return BillingPlan.PRO; | ||||||||
} | ||||||||
} | ||||||||
|
||||||||
$: billingPlan = getNewBillingPlan(selectedOrg); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ArmanNik and @TorstenDittmann might now more on Svelte best practices, but I don't think we need to create a new function for this. You can put an if statement directly here like: console/src/lib/layout/logs.svelte Lines 66 to 68 in 4145174
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For now I've changed it to a ternary operation. The if statement way didn't seem to do the trick correctly (perhaps @TorstenDittmann or @ArmanNik can point out later on what I'm doing wrong there haha). |
||||||||
</script> | ||||||||
|
||||||||
<svelte:head> | ||||||||
|
@@ -268,7 +280,7 @@ | |||||||
</div> | ||||||||
</div> | ||||||||
{/if} | ||||||||
{#if selectedOrg?.$id && selectedOrg?.billingPlan !== BillingPlan.FREE} | ||||||||
{#if selectedOrg?.$id && selectedOrg?.billingPlan !== BillingPlan.FREE && selectedOrg?.billingPlan !== BillingPlan.GITHUB_EDUCATION} | ||||||||
<section | ||||||||
class="card u-margin-block-start-24" | ||||||||
style:--p-card-padding="1.5rem" | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still a bit hesitant to hardcode stuff here. For example, enterprise plans will run into a problem with this logic.
Maybe we can rely on the plan order (after it gets fixed for the education plan)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah definitely! However atm we don't have a plan order in code afaik?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ernstmul We don't have an exact order [there's
tier-*
format though] but possibly we could check viagetNextTier
, not 100% sure as it doesn't include anything about enterprise/custom tiers atm.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tier-*
doesn't hold up anymore, since we now also have auto-1 and cont-1!getNextTier
would definitely work, but perhaps its nice get this info from BE?