From 261b2b2d02308b72233b6379b71bec34d8d16309 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 30 Oct 2026 13:30:27 +0200 Subject: [PATCH] =?UTF-8?q?fix(subscription):=20ceil=20day=20count=20so=20?= =?UTF-8?q?bought=20N=20days=20shows=20'N=20=D0=B4=D0=BD.'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - seconds // 86400 floored to N-1 (bought 10 -> showed 9); use ceil instead - concrete MSK expiry time stays only for the last day (< 24h remaining) --- VERSION | 2 +- user_store.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 6e24410..29631e9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0+80 +0.1.0+81 diff --git a/user_store.py b/user_store.py index 0d49063..5e27399 100644 --- a/user_store.py +++ b/user_store.py @@ -199,8 +199,9 @@ def subscription_time_left( if seconds <= 0: return False, 0, "" if seconds >= 86400: - return True, seconds // 86400, "дн." - # Меньше суток — показываем конкретное время окончания вместо "N ч.". + # Округляем вверх: купленные N дней показываем как "N дн.", а не "N-1". + return True, -(-seconds // 86400), "дн." + # Меньше суток (последний день) — показываем конкретное время окончания вместо "N ч.". display_tz = display_tz or MSK_TIMEZONE stamp = (expires + datetime.timedelta(microseconds=1)).replace(tzinfo=datetime.timezone.utc) return True, stamp.astimezone(display_tz).strftime("%d.%m.%Y %H:%M") + " (МСК)", ""