models: Add method to get `CustomerPlan` name from tier.

This commit is contained in:
Aman Agrawal 2023-12-01 11:42:07 +00:00 committed by Tim Abbott
parent b35ea18829
commit 6b70be38b3
1 changed files with 7 additions and 3 deletions

View File

@ -287,13 +287,17 @@ class CustomerPlan(models.Model):
# TODO maybe override setattr to ensure billing_cycle_anchor, etc
# are immutable.
@property
def name(self) -> str:
@staticmethod
def name_from_tier(tier: int) -> str:
return {
CustomerPlan.TIER_CLOUD_STANDARD: "Zulip Cloud Standard",
CustomerPlan.TIER_CLOUD_PLUS: "Zulip Plus",
CustomerPlan.TIER_CLOUD_ENTERPRISE: "Zulip Enterprise",
}[self.tier]
}[tier]
@property
def name(self) -> str:
return self.name_from_tier(self.tier)
def get_plan_status_as_text(self) -> str:
return {