Skip to content

Commit

Permalink
fix merge and rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
gorskyolga committed Sep 13, 2024
1 parent 3fff312 commit a1dbf27
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/bot/handlers/categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from src.core.logging.utils import logger_decor
from src.core.services.procharity_api import ProcharityAPI

text_chose_category = (
text_choose_category = (
"Чтобы мне было понятнее, с какими задачами ты готов помогать фондам, "
"отметь свои профессиональные компетенции (можно выбрать несколько). "
'После этого нажми "Готово 👌"'
Expand All @@ -40,7 +40,7 @@ async def categories_callback(
selected_categories_with_parents = await user_service.get_user_categories_with_parents(update.effective_user.id)
await context.bot.send_message(
chat_id=update.effective_chat.id,
text=text_chose_category,
text=text_choose_category,
reply_markup=await get_checked_categories_keyboard(categories, selected_categories_with_parents),
)

Expand Down Expand Up @@ -122,7 +122,7 @@ async def subcategories_callback(
parent_id = int(context.match.group(1))
context.user_data["parent_id"] = parent_id
selected_categories = await user_service.get_user_categories(update.effective_user.id)
await _display_chose_subcategories_message(update, parent_id, selected_categories)
await _display_choose_subcategories_message(update, parent_id, selected_categories)


@logger_decor
Expand Down Expand Up @@ -150,10 +150,14 @@ async def select_subcategory_callback(
await user_service.delete_category_from_user(update.effective_user.id, subcategory_id)

parent_id = context.user_data["parent_id"]
await _display_chose_subcategories_message(update, parent_id, selected_categories)
await _display_choose_subcategories_message(update, parent_id, selected_categories)

user = await user_service.get_by_telegram_id(update.effective_user.id)
if user and user.external_user:
await procharity_api.send_user_categories(user.external_user.external_id, selected_categories.keys())


async def _display_chose_subcategories_message(
async def _display_choose_subcategories_message(
update: Update,
parent_id: int,
selected_categories: dict[int, str],
Expand All @@ -169,10 +173,6 @@ async def _display_chose_subcategories_message(
parse_mode=ParseMode.HTML,
)

user = await user_service.get_by_telegram_id(update.effective_user.id)
if user and user.external_user:
await procharity_api.send_user_categories(user.external_user.external_id, selected_categories.keys())


@logger_decor
@registered_user_required
Expand All @@ -188,7 +188,7 @@ async def back_subcategory_callback(
selected_categories_with_parents = await user_service.get_user_categories_with_parents(update.effective_user.id)

await query.message.edit_text(
text_chose_category,
text_choose_category,
reply_markup=await get_checked_categories_keyboard(categories, selected_categories_with_parents),
)

Expand Down

0 comments on commit a1dbf27

Please sign in to comment.