mirror of
https://github.com/koloideal/Quizzi.git
synced 2026-06-10 10:25:28 +03:00
commit
This commit is contained in:
@@ -66,19 +66,19 @@ async def get_test_detail(test_dao: FromDishka[TestDAO], test_repo: FromDishka[T
|
||||
status = "🟢 Активен" if test.is_active else "🔴 Деактивирован"
|
||||
password_str = f"🔒 {test.password}" if test.password else "🔓 Без пароля"
|
||||
attempts_str = f"🔄 {test.attempts}" if test.attempts else "♾️ Без ограничений"
|
||||
expires_str = test.expires_at.strftime("%d.%m.%Y %H:%M") if test.expires_at else "♾️ Без срока"
|
||||
expires_str = f"📅 {test.expires_at.strftime('%d.%m.%Y %H:%M')}" if test.expires_at else "📅 Без срока"
|
||||
group_str = f"🎓 Группа {test.for_group}" if test.for_group else "👥 Для всех"
|
||||
|
||||
test_info = (
|
||||
f"<b>📝 Информация о тесте</b>\n\n"
|
||||
f"<b>Название:</b> {test.title}\n"
|
||||
f"<b>Описание:</b> {test.description or '—'}\n\n"
|
||||
f"<b>Название:</b>\n<blockquote>{test.title}</blockquote>\n"
|
||||
f"<b>Описание:</b>\n<blockquote>{test.description or '—'}</blockquote>\n\n"
|
||||
f"<b>Статус:</b> {status}\n"
|
||||
f"<b>Вопросов:</b> {questions_count}\n"
|
||||
f"{password_str}\n"
|
||||
f"<b>Попыток:</b> {attempts_str}\n"
|
||||
f"{expires_str}\n"
|
||||
f"{group_str}\n\n"
|
||||
f"<b>Пароль:</b> {password_str}\n"
|
||||
f"<b>Попытки:</b> {attempts_str}\n"
|
||||
f"<b>Срок:</b> {expires_str}\n"
|
||||
f"<b>Группа:</b> {group_str}\n\n"
|
||||
f"<b>Создан:</b> {test.created_at.strftime('%d.%m.%Y %H:%M') if test.created_at else '—'}"
|
||||
)
|
||||
|
||||
@@ -161,6 +161,18 @@ async def qr_media_selector(data: dict, widget, manager: DialogManager):
|
||||
}
|
||||
|
||||
|
||||
async def on_edit_menu(_callback: CallbackQuery, _button: Button, manager: DialogManager):
|
||||
await manager.switch_to(AdminTestsSG.edit_menu)
|
||||
|
||||
|
||||
async def on_back_to_detail(_callback: CallbackQuery, _button: Button, manager: DialogManager):
|
||||
await manager.switch_to(AdminTestsSG.test_detail)
|
||||
|
||||
|
||||
async def on_back_to_edit_menu(_callback: CallbackQuery, _button: Button, manager: DialogManager):
|
||||
await manager.switch_to(AdminTestsSG.edit_menu)
|
||||
|
||||
|
||||
async def on_edit_password(_callback: CallbackQuery, _button: Button, manager: DialogManager):
|
||||
await manager.switch_to(AdminTestsSG.edit_password)
|
||||
|
||||
@@ -351,21 +363,29 @@ tests_dialog = Dialog(
|
||||
on_click=on_toggle_active
|
||||
),
|
||||
Button(Const("🔗 Поделиться"), id="share", on_click=on_share_test),
|
||||
Button(Const("🔑 Изменить пароль"), id="edit_password", on_click=on_edit_password),
|
||||
Button(Const("🔄 Изменить попытки"), id="edit_attempts", on_click=on_edit_attempts),
|
||||
Button(Const("👥 Изменить группу"), id="edit_group", on_click=on_edit_group),
|
||||
Button(Const("📅 Изменить срок"), id="edit_expires", on_click=on_edit_expires),
|
||||
Button(Const("✏️ Изменить"), id="edit_menu", on_click=on_edit_menu),
|
||||
Button(Const("◀️ Назад"), id="back", on_click=on_back_to_list),
|
||||
),
|
||||
state=AdminTestsSG.test_detail,
|
||||
getter=get_test_detail,
|
||||
),
|
||||
Window(
|
||||
Const("<b>✏️ Изменить тест</b>\n\nВыберите, что хотите изменить:"),
|
||||
Column(
|
||||
Button(Const("🔑 Пароль"), id="edit_password", on_click=on_edit_password),
|
||||
Button(Const("🔄 Попытки"), id="edit_attempts", on_click=on_edit_attempts),
|
||||
Button(Const("👥 Группа"), id="edit_group", on_click=on_edit_group),
|
||||
Button(Const("📅 Срок действия"), id="edit_expires", on_click=on_edit_expires),
|
||||
Button(Const("◀️ Назад"), id="back", on_click=on_back_to_detail),
|
||||
),
|
||||
state=AdminTestsSG.edit_menu,
|
||||
),
|
||||
Window(
|
||||
Const("<b>🔑 Изменение пароля</b>\n\n💬 <b>Введите новый пароль</b> или удалите текущий:\n<i>(максимум 255 символов)</i>"),
|
||||
MessageInput(on_password_input),
|
||||
Column(
|
||||
Button(Const("🗑 Удалить пароль"), id="remove_password", on_click=on_remove_password),
|
||||
Button(Const("◀️ Назад"), id="back", on_click=on_back_to_list),
|
||||
Button(Const("◀️ Назад"), id="back", on_click=on_back_to_edit_menu),
|
||||
),
|
||||
state=AdminTestsSG.edit_password,
|
||||
),
|
||||
@@ -374,7 +394,7 @@ tests_dialog = Dialog(
|
||||
MessageInput(on_attempts_input_edit),
|
||||
Column(
|
||||
Button(Const("🗑 Без ограничений"), id="remove_attempts", on_click=on_remove_attempts),
|
||||
Button(Const("◀️ Назад"), id="back", on_click=on_back_to_list),
|
||||
Button(Const("◀️ Назад"), id="back", on_click=on_back_to_edit_menu),
|
||||
),
|
||||
state=AdminTestsSG.edit_attempts,
|
||||
),
|
||||
@@ -394,7 +414,7 @@ tests_dialog = Dialog(
|
||||
),
|
||||
Column(
|
||||
Button(Const("🗑 Для всех групп"), id="remove_group", on_click=on_remove_group),
|
||||
Button(Const("◀️ Назад"), id="back", on_click=on_back_to_list),
|
||||
Button(Const("◀️ Назад"), id="back", on_click=on_back_to_edit_menu),
|
||||
),
|
||||
state=AdminTestsSG.edit_group,
|
||||
getter=get_groups_for_edit,
|
||||
@@ -404,7 +424,7 @@ tests_dialog = Dialog(
|
||||
Calendar(id="calendar", on_click=on_date_selected_for_test),
|
||||
Column(
|
||||
Button(Const("🗑 Удалить срок"), id="remove_expires", on_click=on_remove_expires),
|
||||
Button(Const("◀️ Назад"), id="back", on_click=on_back_to_list),
|
||||
Button(Const("◀️ Назад"), id="back", on_click=on_back_to_edit_menu),
|
||||
),
|
||||
state=AdminTestsSG.edit_expires,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user