Fix account enrollment and operator callback flows with Redis scenarios
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Админские обработчики для управления счетами и верификации"""
|
||||
from src.filters.numeric_callback import NumericCallback
|
||||
from src.utils.account_input import parse_account_records
|
||||
from src.utils.text_output import answer_plain_pages
|
||||
from src.utils.text_output import answer_plain_pages, edit_plain_pages
|
||||
from src.utils.input_validation import numeric_id
|
||||
from src.filters.dialog_input import NotCommand
|
||||
from src.utils.errors import public_error
|
||||
@@ -332,7 +333,7 @@ async def show_lottery_selection(message: Message, prev_text: str, state: FSMCon
|
||||
)
|
||||
|
||||
|
||||
@router.callback_query(F.data.startswith("add_to_lottery_"))
|
||||
@router.callback_query(NumericCallback('add_to_lottery_'))
|
||||
async def add_accounts_to_lottery(callback: CallbackQuery, state: FSMContext):
|
||||
"""Добавить счета в выбранный розыгрыш"""
|
||||
lottery_id = int(callback.data.split("_")[-1])
|
||||
@@ -356,12 +357,14 @@ async def add_accounts_to_lottery(callback: CallbackQuery, state: FSMContext):
|
||||
await state.clear()
|
||||
return
|
||||
|
||||
lottery_title = lottery.title
|
||||
from .account_services import AccountParticipationService
|
||||
result = await AccountParticipationService.add_accounts_bulk(session, lottery_id, [a['account_number'] for a in accounts])
|
||||
success_count = result['added']
|
||||
errors = result['errors']
|
||||
|
||||
text = f"📊 **Добавление в розыгрыш '{lottery.title}'**\n\n"
|
||||
await state.clear()
|
||||
text = f"📊 Добавление в розыгрыш '{lottery_title}'\n\n"
|
||||
|
||||
if success_count:
|
||||
text += f"✅ Добавлено счетов: {success_count}\n\n"
|
||||
@@ -371,8 +374,8 @@ async def add_accounts_to_lottery(callback: CallbackQuery, state: FSMContext):
|
||||
for error in errors[:3]:
|
||||
text += f"• {error}\n"
|
||||
|
||||
await callback.message.edit_text(text)
|
||||
await state.clear()
|
||||
await edit_plain_pages(callback.message, text)
|
||||
await callback.answer("Готово")
|
||||
|
||||
|
||||
@router.callback_query(F.data == "skip_lottery_add")
|
||||
|
||||
Reference in New Issue
Block a user