fix(subscription): show expiry clock time (MSK) when under a day

- subscription_time_left: replace floor-div '23 ч.'/'мин.' branches with the
  concrete expiry timestamp when less than a full day remains
- add MSK_TIMEZONE (UTC+3) as display default; label time as '(МСК)'
- add shared subscription_status_text helper, use it in status menu,
  post-payment reply and dev confirmation instead of floor-rounded days
- tests: cover under-a-day clock format; fix stale to_thread mock
This commit is contained in:
admin committed 2026-10-30 13:04:38 +02:00
1 parent 140f2f7263
commit 87f22fb249
6 files changed
+52 -17

No files matched your search

+5 -4
View File
@@ -23,6 +23,8 @@ from user_store import (
activate_subscription,
connect,
ensure_subscription,
subscription_row,
subscription_status_text,
)
logger = logging.getLogger(__name__)
@@ -155,7 +157,8 @@ async def handle_successful_payment(message: Message) -> None:
days = 1
await asyncio.to_thread(ensure_subscription, message.from_user.id)
days_left = await asyncio.to_thread(activate_subscription_days, message.from_user.id, days)
await asyncio.to_thread(activate_subscription_days, message.from_user.id, days)
sub = await asyncio.to_thread(subscription_row, message.from_user.id, db_path)
await asyncio.to_thread(
save_payment,
charge_id,
@@ -165,9 +168,7 @@ async def handle_successful_payment(message: Message) -> None:
payment.total_amount,
db_path,
)
await message.answer(
f"Подписка активна\nЗакончится через {days_left} дн."
)
await message.answer(subscription_status_text(sub))
async def _reject(message: Message, charge_id: str, reason: str) -> None: