From 74719669fbc50c273a0a982e7a4529a5da82e2c2 Mon Sep 17 00:00:00 2001 From: machka-pasla Date: Mon, 4 Aug 2025 18:16:59 +0300 Subject: [PATCH] Fix activation date reference and update localization for promo code toggle success message - Changed the reference from `created_at` to `activated_at` in the promo activations handler to accurately reflect the activation date. - Updated the localization files for both English and Russian to remove HTML tags from the promo code toggle success message, enhancing clarity. --- bot/handlers/admin/promo_codes.py | 2 +- db/dal/promo_code_dal.py | 2 +- locales/en.json | 2 +- locales/ru.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bot/handlers/admin/promo_codes.py b/bot/handlers/admin/promo_codes.py index 623624c..525d495 100644 --- a/bot/handlers/admin/promo_codes.py +++ b/bot/handlers/admin/promo_codes.py @@ -1095,7 +1095,7 @@ async def promo_activations_handler(callback: types.CallbackQuery, i18n_data: di )] for activation in activations: - activation_date = activation.created_at.strftime('%Y-%m-%d %H:%M') if activation.created_at else "N/A" + activation_date = activation.activated_at.strftime('%Y-%m-%d %H:%M') if activation.activated_at else "N/A" text_parts.append(_( "admin_promo_activation_item", default="πŸ‘€ User ID: {user_id}\nπŸ“… Π”Π°Ρ‚Π°: {date}\n", diff --git a/db/dal/promo_code_dal.py b/db/dal/promo_code_dal.py index f937b4d..5d1f017 100644 --- a/db/dal/promo_code_dal.py +++ b/db/dal/promo_code_dal.py @@ -77,7 +77,7 @@ async def get_promo_activations_by_code_id(session: AsyncSession, promo_code_id: from db.models import PromoCodeActivation stmt = (select(PromoCodeActivation) .where(PromoCodeActivation.promo_code_id == promo_code_id) - .order_by(PromoCodeActivation.created_at.desc()) + .order_by(PromoCodeActivation.activated_at.desc()) .limit(50)) # Limit to last 50 activations result = await session.execute(stmt) return result.scalars().all() diff --git a/locales/en.json b/locales/en.json index ef6d71b..3226fd0 100644 --- a/locales/en.json +++ b/locales/en.json @@ -420,7 +420,7 @@ "admin_promo_toggle_status_button": "πŸ”„ On/Off", "admin_promo_view_activations_button": "πŸ“‹ Activations", "admin_promo_back_to_list_button": "⬅️ Back to list", - "admin_promo_toggle_success": "βœ… Promo code {code} {status}", + "admin_promo_toggle_success": "βœ… Promo code {code} {status}", "admin_promo_toggle_failed": "❌ Error changing promo code status", "admin_promo_no_activations": "πŸ“‹ Activations of promo code: {code}\n\n❌ No activations found", "admin_promo_activations_header": "πŸ“‹ Activations of promo code: {code}\n\n", diff --git a/locales/ru.json b/locales/ru.json index 086d864..2f1cb06 100644 --- a/locales/ru.json +++ b/locales/ru.json @@ -419,7 +419,7 @@ "admin_promo_toggle_status_button": "πŸ”„ Π’ΠΊΠ»/Π’Ρ‹ΠΊΠ»", "admin_promo_view_activations_button": "πŸ“‹ Активации", "admin_promo_back_to_list_button": "⬅️ К списку", - "admin_promo_toggle_success": "βœ… ΠŸΡ€ΠΎΠΌΠΎΠΊΠΎΠ΄ {code} {status}", + "admin_promo_toggle_success": "βœ… ΠŸΡ€ΠΎΠΌΠΎΠΊΠΎΠ΄ {code} {status}", "admin_promo_toggle_failed": "❌ Ошибка измСнСния статуса ΠΏΡ€ΠΎΠΌΠΎΠΊΠΎΠ΄Π°", "admin_promo_no_activations": "πŸ“‹ Активации ΠΏΡ€ΠΎΠΌΠΎΠΊΠΎΠ΄Π°: {code}\n\n❌ Активаций Π½Π΅ Π½Π°ΠΉΠ΄Π΅Π½ΠΎ", "admin_promo_activations_header": "πŸ“‹ Активации ΠΏΡ€ΠΎΠΌΠΎΠΊΠΎΠ΄Π°: {code}\n\n",