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:
1 parent
140f2f7263
commit
87f22fb249
6 files changed
+52
-17
No files matched your search
@@ -436,11 +436,14 @@ async def confirm_development_payment(callback: CallbackQuery) -> None:
|
||||
await callback.answer("Dev-оплата подтверждена. Срок подписки не изменён.")
|
||||
return
|
||||
await asyncio.to_thread(ensure_subscription, user_id)
|
||||
days_left = await asyncio.to_thread(user_store.activate_subscription_days, user_id, days)
|
||||
await asyncio.to_thread(user_store.activate_subscription_days, user_id, days)
|
||||
sub = await asyncio.to_thread(subscription_row, user_id)
|
||||
await callback.answer("Dev-оплата подтверждена.")
|
||||
if isinstance(callback.message, Message):
|
||||
await callback.message.edit_reply_markup(reply_markup=None)
|
||||
await callback.message.edit_text(f"Подписка активна\nЗакончится через {days_left} дн.")
|
||||
await callback.message.edit_text(
|
||||
user_store.subscription_status_text(sub)
|
||||
)
|
||||
|
||||
|
||||
@router.message(CommandStart())
|
||||
@@ -470,11 +473,7 @@ async def _show_subscription_info(
|
||||
if not sub:
|
||||
text = "Подписка закончилась"
|
||||
else:
|
||||
active, value, unit = user_store.subscription_time_left(sub)
|
||||
text = (
|
||||
f"Подписка активна\nЗакончится через {value} {unit}"
|
||||
if active else "Подписка закончилась"
|
||||
)
|
||||
text = user_store.subscription_status_text(sub)
|
||||
|
||||
if mode == "subscription":
|
||||
markup = mode_keyboard("subscription", subscription_purchased=bool(sub and sub["last_paid_at"]))
|
||||
|
||||
Reference in new issue
Block a user