From 7f2e4615ee1e18aeadc4bfda52bcb1dd617a689c Mon Sep 17 00:00:00 2001 From: gy9vin Date: Sun, 19 Oct 2025 15:52:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D0=BE=D0=B9=20=D0=BF=D0=BE=D0=BA=D1=83=D0=BF=D0=BA?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/database/crud/subscription.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/database/crud/subscription.py b/app/database/crud/subscription.py index 9cc8885a..7b304a8d 100644 --- a/app/database/crud/subscription.py +++ b/app/database/crud/subscription.py @@ -1309,12 +1309,10 @@ async def activate_pending_subscription( # Если указан период, обновляем дату окончания if period_days is not None: - if pending_subscription.end_date <= current_time: - # Если текущая дата окончания уже прошла, устанавливаем новую - pending_subscription.end_date = current_time + timedelta(days=period_days) - else: - # Если дата окончания в будущем, продляем её - pending_subscription.end_date = pending_subscription.end_date + timedelta(days=period_days) + effective_start = pending_subscription.start_date or current_time + if effective_start < current_time: + effective_start = current_time + pending_subscription.end_date = effective_start + timedelta(days=period_days) # Обновляем дату начала, если она не установлена или в прошлом if not pending_subscription.start_date or pending_subscription.start_date < current_time: