feat: enhance subscription management with discount calculations and update support messages
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import math
|
||||
import urllib.parse
|
||||
from datetime import UTC, datetime, timedelta
|
||||
from random import choice
|
||||
@@ -179,8 +180,15 @@ def calculate_price(subscription: SubscriptionPlan):
|
||||
) * convert_duration_to_int(subscription.duration)
|
||||
|
||||
|
||||
def get_discount(months) -> float:
|
||||
if months <= 0:
|
||||
return 0
|
||||
calculated = 5 * (math.log2(months / 3) + 1)
|
||||
return max(0, calculated)
|
||||
|
||||
|
||||
def format_subscription_link(link: str | None = None):
|
||||
return f"<code>{link or '...'}</code>"
|
||||
return f"<code>{link or texts.NOTHING_PLACEHOLDER}</code>"
|
||||
|
||||
|
||||
def format_share_deep_link(link: str):
|
||||
|
||||
Reference in New Issue
Block a user