Skip to content

Commit a723908

Browse files
committed
style: Мелкие исправления меню и премиум эмодзи
1 parent 68cce62 commit a723908

File tree

24 files changed

+342
-196
lines changed

24 files changed

+342
-196
lines changed

tgbot/dialogs/getters/common/db.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
from stp_database.repo.Stats.requests import StatsRequestsRepo
55
from stp_database.repo.STP import MainRequestsRepo
66

7+
from tgbot.misc.constants import EMOJI, tg_emoji
8+
79

810
async def db_getter(
911
user: Employee, stp_repo: MainRequestsRepo, stats_repo: StatsRequestsRepo, **_kwargs
@@ -21,10 +23,10 @@ async def db_getter(
2123
Словарь с базовыми данными о сотруднике и репозиториях баз данных
2224
"""
2325
user_tests = await stats_repo.tests.get_tests(employee_fullname=user.fullname)
24-
2526
return {
2627
"user": user,
2728
"stp_repo": stp_repo,
2829
"stats_repo": stats_repo,
2930
"have_tests": True if user_tests else False,
31+
**{name: tg_emoji(name) for name in EMOJI},
3032
}

tgbot/dialogs/getters/common/kpi.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from stp_database.repo.Stats.requests import StatsRequestsRepo
1111
from stp_database.repo.STP import MainRequestsRepo
1212

13+
from tgbot.misc.constants import tg_emoji
1314
from tgbot.misc.dicts import months_emojis, russian_months
1415
from tgbot.misc.helpers import strftime_date
1516
from tgbot.services.files_processing.utils.time_parser import get_current_month
@@ -138,19 +139,18 @@ async def kpi_getter(
138139
).strftime(strftime_date)
139140

140141
if user.role == 2:
141-
kpi_text = f"""🌟 <b>Показатели</b>
142+
kpi_text = f"""{tg_emoji("star")} <b>Показатели</b>
142143
143-
🔧 <b>FLR - {SalaryFormatter.format_percentage(premium.flr_premium)}</b>
144+
{tg_emoji("gear")} <b>FLR - {SalaryFormatter.format_percentage(premium.flr_premium)}</b>
144145
<blockquote>Факт: {SalaryFormatter.format_value(premium.flr)}</blockquote>
145146
146-
⚖️ <b>ГОК - {SalaryFormatter.format_percentage(premium.gok_premium)}</b>
147+
{tg_emoji("weights")} <b>ГОК - {SalaryFormatter.format_percentage(premium.gok_premium)}</b>
147148
<blockquote>Факт: {SalaryFormatter.format_value(premium.gok)}</blockquote>
148149
149-
⏱️ <b>AHT - {SalaryFormatter.format_percentage(premium.aht_premium)}</b>
150+
{tg_emoji("lightning")} <b>AHT - {SalaryFormatter.format_percentage(premium.aht_premium)}</b>
150151
<blockquote>Факт: {SalaryFormatter.format_value(premium.aht)}</blockquote>
151152
152-
💰 <b>Итого:</b>
153-
<b>Общая премия: {SalaryFormatter.format_percentage(premium.total_premium)}</b>
153+
{tg_emoji("money_bag")} <b>Итого:</b> {SalaryFormatter.format_percentage(premium.total_premium)}
154154
155155
<i>Данные из <b><a href='okc.ertelecom.ru/yii/ure/report/index'>URE</a></b> на <b>{updated_at_str}</b>
156156
Меню обновлено в <b>{current_time_str}</b></i>"""
@@ -162,19 +162,18 @@ async def kpi_getter(
162162
else f"📈 Всего звонков: {SalaryFormatter.format_value(premium.contacts_count)}"
163163
)
164164

165-
kpi_text = f"""🌟 <b>Показатели</b>
165+
kpi_text = f"""{tg_emoji("star")} <b>Показатели</b>
166166
167-
🌟 <b>CSAT - {SalaryFormatter.format_percentage(premium.csat_premium)}</b>
167+
{tg_emoji("percent")} <b>CSAT - {SalaryFormatter.format_percentage(premium.csat_premium)}</b>
168168
<blockquote>Факт: {SalaryFormatter.format_value(premium.csat)}</blockquote>
169169
170-
⏱️ <b>AHT - {SalaryFormatter.format_percentage(premium.aht_premium)}</b>
171-
<blockquote>Факт: {SalaryFormatter.format_value(premium.aht)}</blockquote>
172-
173-
⚖️ <b>ГОК - {SalaryFormatter.format_percentage(premium.gok_premium)}</b>
170+
{tg_emoji("weights")} <b>ГОК - {SalaryFormatter.format_percentage(premium.gok_premium)}</b>
174171
<blockquote>Факт: {SalaryFormatter.format_value(premium.gok)}</blockquote>
175172
176-
💰 <b>Итого:</b>
177-
<b>Общая премия: {SalaryFormatter.format_percentage(premium.total_premium)}</b>
173+
{tg_emoji("lightning")} <b>AHT - {SalaryFormatter.format_percentage(premium.aht_premium)}</b>
174+
<blockquote>Факт: {SalaryFormatter.format_value(premium.aht)}</blockquote>
175+
176+
{tg_emoji("money_bag")} <b>Итого:</b> {SalaryFormatter.format_percentage(premium.total_premium)}
178177
179178
{contacts_text}
180179
@@ -208,7 +207,7 @@ async def kpi_requirements_getter(
208207

209208
if not premium:
210209
return {
211-
"requirements_text": """🧮 <b>Нормативы</b>
210+
"requirements_text": f"""{tg_emoji("abacus")} <b>Нормативы</b>
212211
213212
Не смог найти твои показатели в премиуме :(""",
214213
"month_display": data.get("month_display", "📅 Месяц"),
@@ -219,7 +218,7 @@ async def kpi_requirements_getter(
219218
user=user, premium=premium, is_head=True if user.role == 2 else False
220219
)
221220
except Exception:
222-
requirements_text = """🧮 <b>Нормативы</b>
221+
requirements_text = f"""{tg_emoji("abacus")} <b>Нормативы</b>
223222
224223
Кажется, нормативы пока что не выставлены 🤷‍♂️"""
225224

@@ -252,7 +251,7 @@ async def salary_getter(
252251

253252
if not premium:
254253
return {
255-
"salary_text": """💰 <b>Зарплата</b>
254+
"salary_text": f"""{tg_emoji("money_bag")} <b>Зарплата</b>
256255
257256
Не смог найти твои показатели в премиуме :(""",
258257
"month_display": data.get("month_display", "📅 Месяц"),
@@ -269,7 +268,7 @@ async def salary_getter(
269268
else None,
270269
)
271270
except Exception as e:
272-
salary_result = f"""💰 <b>Зарплата</b>
271+
salary_result = f"""{tg_emoji("money_bag")} <b>Зарплата</b>
273272
274273
Не смог посчитать твою зарплату 🥺
275274

tgbot/dialogs/getters/common/schedules.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from stp_database.repo.Stats import StatsRequestsRepo
1313
from stp_database.repo.STP import MainRequestsRepo
1414

15+
from tgbot.misc.constants import EMOJI, tg_emoji
1516
from tgbot.misc.dicts import months_emojis, russian_months, schedule_types
1617
from tgbot.misc.helpers import format_fullname, strftime_date
1718
from tgbot.services.files_processing.handlers.schedule import schedule_service
@@ -40,6 +41,7 @@ async def schedules_getter(
4041
"exchange_banned": exchange_banned,
4142
"tutor_access": tutors_access,
4243
"role": user.role,
44+
**{name: tg_emoji(name) for name in EMOJI},
4345
}
4446

4547

tgbot/dialogs/getters/user/main.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from stp_database.repo.Stats.requests import StatsRequestsRepo
77
from stp_database.repo.STP import MainRequestsRepo
88

9+
from tgbot.misc.constants import EMOJI, tg_emoji
910
from tgbot.misc.helpers import format_fullname, short_name, strftime_date
1011

1112

@@ -52,3 +53,9 @@ async def tests_getter(
5253
"created_at_str": created_at_str,
5354
"current_time_str": current_time_str,
5455
}
56+
57+
58+
async def horn_getter(**_kwargs):
59+
return {
60+
**{name: tg_emoji(name) for name in EMOJI},
61+
}

tgbot/dialogs/menus/admin/main.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99

1010
from tgbot.dialogs.events.common.broadcast import start_broadcast_dialog
1111
from tgbot.dialogs.events.common.files.files import start_files_dialog
12-
from tgbot.dialogs.events.common.groups import start_groups_dialog
13-
from tgbot.dialogs.events.common.search import start_search_dialog
1412
from tgbot.dialogs.states.admin import AdminSG
15-
from tgbot.dialogs.widgets.buttons import SUPPORT_BTN
13+
from tgbot.dialogs.widgets.buttons import GROUPS_BTN, SEARCH_BTN, SUPPORT_BTN
1614

1715
menu_window = Window(
1816
Format("""👋 <b>Привет</b>!
@@ -24,12 +22,7 @@
2422
Button(Const("📂 Файлы"), id="files", on_click=start_files_dialog),
2523
Button(Const("📢 Рассылки"), id="broadcast", on_click=start_broadcast_dialog),
2624
),
27-
Row(
28-
Button(
29-
Const("🕵🏻 Поиск сотрудника"), id="search", on_click=start_search_dialog
30-
),
31-
Button(Const("👯‍♀️ Группы"), id="groups", on_click=start_groups_dialog),
32-
),
25+
Row(SEARCH_BTN, GROUPS_BTN),
3326
SUPPORT_BTN,
3427
state=AdminSG.menu,
3528
)

tgbot/dialogs/menus/common/schedules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
from tgbot.dialogs.widgets.exchange_calendar import ExchangeCalendar
4444

4545
menu_window = Window(
46-
Format("""<b>📅 Меню графиков</b>
46+
Format("""{calendar} <b>Меню графиков</b>
4747
4848
Здесь ты найдешь все, что связано с графиками"""),
4949
Row(

tgbot/dialogs/menus/common/search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777

7878
specialists_window = Window(
7979
Format(
80-
"""👤 Специалисты
80+
"""👤 <b>Специалисты</b>
8181
8282
Найдено специалистов: {total_specialists}""",
8383
),
@@ -113,7 +113,7 @@
113113

114114
heads_window = Window(
115115
Format(
116-
"""👑 Руководители
116+
"""👑 <b>Руководители</b>
117117
118118
Найдено руководителей: {total_heads}""",
119119
),

tgbot/dialogs/menus/gok/main.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
11
"""Генерация диалога для ГОК."""
22

33
from aiogram_dialog import Dialog, DialogManager
4-
from aiogram_dialog.widgets.kbd import Button, Row
5-
from aiogram_dialog.widgets.text import Const, Format
4+
from aiogram_dialog.widgets.kbd import Row
5+
from aiogram_dialog.widgets.text import Format
66
from aiogram_dialog.window import Window
77

8-
from tgbot.dialogs.events.common.game.game import start_game_dialog
9-
from tgbot.dialogs.events.common.groups import start_groups_dialog
10-
from tgbot.dialogs.events.common.search import start_search_dialog
118
from tgbot.dialogs.states.gok import GokSG
12-
from tgbot.dialogs.widgets.buttons import SUPPORT_BTN
9+
from tgbot.dialogs.widgets.buttons import GAME_BTN, GROUPS_BTN, SEARCH_BTN, SUPPORT_BTN
1310

1411
menu_window = Window(
1512
Format("""👋 <b>Привет</b>!
1613
1714
Я - бот-помощник СТП
1815
1916
<i>Используй меню для взаимодействия с ботом</i>"""),
20-
Button(Const("🏮 Игра"), id="game", on_click=start_game_dialog),
21-
Row(
22-
Button(
23-
Const("🕵🏻 Поиск сотрудника"), id="search", on_click=start_search_dialog
24-
),
25-
Button(Const("👯‍♀️ Группы"), id="groups", on_click=start_groups_dialog),
26-
),
17+
GAME_BTN,
18+
Row(SEARCH_BTN, GROUPS_BTN),
2719
SUPPORT_BTN,
2820
state=GokSG.menu,
2921
)

tgbot/dialogs/menus/head/main.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@
88
from aiogram_dialog.widgets.text import Const, Format
99
from aiogram_dialog.window import Window
1010

11-
from tgbot.dialogs.events.common.game.game import start_game_dialog
12-
from tgbot.dialogs.events.common.groups import start_groups_dialog
13-
from tgbot.dialogs.events.common.kpi import start_kpi_dialog
14-
from tgbot.dialogs.events.common.schedules import start_schedules_dialog
15-
from tgbot.dialogs.events.common.search import start_search_dialog
1611
from tgbot.dialogs.events.heads.group import start_group_dialog
1712
from tgbot.dialogs.states.head import HeadSG
18-
from tgbot.dialogs.widgets.buttons import SUPPORT_BTN
13+
from tgbot.dialogs.widgets.buttons import (
14+
GAME_BTN,
15+
GROUPS_BTN,
16+
KPI_BTN,
17+
SCHEDULES_BTN,
18+
SEARCH_BTN,
19+
SUPPORT_BTN,
20+
)
1921

2022
logger = logging.getLogger(__name__)
2123

@@ -27,17 +29,12 @@
2729
2830
<i>Используй меню для взаимодействия с ботом</i>"""),
2931
Row(
30-
Button(Const("📅 Графики"), id="exchanges", on_click=start_schedules_dialog),
31-
Button(Const("🌟 Показатели"), id="kpi", on_click=start_kpi_dialog),
32+
SCHEDULES_BTN,
33+
KPI_BTN,
3234
),
33-
Button(Const("🏮 Игра"), id="game", on_click=start_game_dialog),
35+
GAME_BTN,
3436
Button(Const("❤️ Моя группа"), id="my_group", on_click=start_group_dialog),
35-
Row(
36-
Button(
37-
Const("🕵🏻 Поиск сотрудника"), id="search", on_click=start_search_dialog
38-
),
39-
Button(Const("👯‍♀️ Группы"), id="groups", on_click=start_groups_dialog),
40-
),
37+
Row(SEARCH_BTN, GROUPS_BTN),
4138
SUPPORT_BTN,
4239
state=HeadSG.menu,
4340
)

tgbot/dialogs/menus/mip/main.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77

88
from tgbot.dialogs.events.common.broadcast import start_broadcast_dialog
99
from tgbot.dialogs.events.common.files.files import start_files_dialog
10-
from tgbot.dialogs.events.common.game.game import start_game_dialog
11-
from tgbot.dialogs.events.common.groups import start_groups_dialog
12-
from tgbot.dialogs.events.common.search import start_search_dialog
1310
from tgbot.dialogs.states.mip import MipSG
14-
from tgbot.dialogs.widgets.buttons import SUPPORT_BTN
11+
from tgbot.dialogs.widgets.buttons import GAME_BTN, GROUPS_BTN, SEARCH_BTN, SUPPORT_BTN
1512

1613
menu_window = Window(
1714
Format("""👋 <b>Привет</b>!
@@ -23,13 +20,8 @@
2320
Button(Const("📂 Файлы"), id="files", on_click=start_files_dialog),
2421
Button(Const("📢 Рассылки"), id="broadcast", on_click=start_broadcast_dialog),
2522
),
26-
Button(Const("🏮 Игра"), id="game", on_click=start_game_dialog),
27-
Row(
28-
Button(
29-
Const("🕵🏻 Поиск сотрудника"), id="search", on_click=start_search_dialog
30-
),
31-
Button(Const("👯‍♀️ Группы"), id="groups", on_click=start_groups_dialog),
32-
),
23+
GAME_BTN,
24+
Row(SEARCH_BTN, GROUPS_BTN),
3325
SUPPORT_BTN,
3426
state=MipSG.menu,
3527
)

0 commit comments

Comments
 (0)