fix: tariff selection in admin panel and key operation

This commit is contained in:
Capybara-z
2025-07-19 23:16:46 +03:00
parent 315459ed2e
commit d701ce31c8
3 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -32,7 +32,7 @@ async def admin_gift_menu(callback: CallbackQuery):
@router.callback_query(F.data == "admin_gift_create")
async def admin_create_gift_step1(callback: CallbackQuery, session: AsyncSession):
stmt = select(Tariff).where(Tariff.group_code == "gifts", Tariff.is_active is True).order_by(Tariff.duration_days)
stmt = select(Tariff).where(Tariff.group_code == "gifts", Tariff.is_active.is_(True)).order_by(Tariff.duration_days)
result = await session.execute(stmt)
tariffs = result.scalars().all()
@@ -83,7 +83,7 @@ async def admin_gift_show_tariffs_in_subgroup(callback: CallbackQuery, session:
return
stmt = (
select(Tariff).where(Tariff.group_code == "gifts", Tariff.is_active is True).order_by(Tariff.duration_days)
select(Tariff).where(Tariff.group_code == "gifts", Tariff.is_active.is_(True)).order_by(Tariff.duration_days)
)
result = await session.execute(stmt)
tariffs = result.scalars().all()
+1 -1
View File
@@ -657,7 +657,7 @@ async def handle_user_choose_tariff(
await state.set_state(RenewTariffState.selecting_tariff)
result = await session.execute(
select(Tariff).where(Tariff.group_code == group_code, Tariff.is_active is True).order_by(Tariff.id)
select(Tariff).where(Tariff.group_code == group_code, Tariff.is_active.is_(True)).order_by(Tariff.id)
)
tariffs = result.scalars().all()
+3 -3
View File
@@ -300,7 +300,7 @@ async def renew_key_in_cluster(
if tariff_group_row:
result = await session.execute(
select(Tariff)
.where(Tariff.group_code == tariff_group_row, Tariff.is_active is True)
.where(Tariff.group_code == tariff_group_row, Tariff.is_active.is_(True))
.order_by(Tariff.duration_days.desc())
.limit(1)
)
@@ -554,7 +554,7 @@ async def update_key_on_cluster(
result = await session.execute(
select(Tariff)
.where(Tariff.group_code == group_code, Tariff.is_active is True)
.where(Tariff.group_code == group_code, Tariff.is_active.is_(True))
.order_by(Tariff.duration_days.desc())
.limit(1)
)
@@ -614,7 +614,7 @@ async def update_key_on_cluster(
result = await session.execute(
select(Tariff)
.where(Tariff.group_code == group_code, Tariff.is_active is True)
.where(Tariff.group_code == group_code, Tariff.is_active.is_(True))
.order_by(Tariff.duration_days.desc())
.limit(1)
)