This commit is contained in:
2026-04-04 00:44:09 +03:00
parent 98274ffa49
commit b548021b86
2 changed files with 15 additions and 17 deletions
@@ -220,20 +220,6 @@ async def get_generate_report_data(
"""
has_periods = False
periods_list = []
elif not completed_periods and active_period:
content = """
<blockquote>📊 <b>Генерация отчёта</b></blockquote>
Будет сгенерирован отчёт по активному периоду.
"""
has_periods = True
next_day = active_period.start_date + timedelta(days=1)
month_name = MONTH_NAMES[next_day.month]
year = next_day.year
periods_list = [(
f"{month_name} {year} (активный, с {active_period.start_date.strftime('%d.%m.%Y')})",
active_period.id
)]
else:
content = """
<blockquote>📊 <b>Генерация отчёта</b></blockquote>
@@ -242,6 +228,16 @@ async def get_generate_report_data(
"""
has_periods = True
periods_list = []
if active_period:
next_day = active_period.start_date + timedelta(days=1)
month_name = MONTH_NAMES[next_day.month]
year = next_day.year
periods_list.append((
f"{month_name} {year} (активный, с {active_period.start_date.strftime('%d.%m.%Y')})",
active_period.id
))
for period in sorted(completed_periods, key=lambda p: p.start_date, reverse=True):
if period.end_date:
next_day = period.start_date + timedelta(days=1)
@@ -1,4 +1,5 @@
from aiogram.types import Message, CallbackQuery
from aiogram.utils.markdown import html_decoration as hd
from aiogram_dialog import Window, DialogManager
from aiogram_dialog.widgets.text import Format, Const
from aiogram_dialog.widgets.kbd import Row, SwitchTo, Button, ScrollingGroup, Select, Group
@@ -102,7 +103,7 @@ async def get_resident_info_data(
room = await rooms_repository.get_room_by_id(resident.room)
room_number = room.number if room else "???"
name = resident.real_name if resident.real_name else "Без имени"
name = hd.quote(resident.real_name) if resident.real_name else "Без имени"
status = "🟢 Занят" if resident.is_busy else "⚪️ Свободен"
is_admin = False
@@ -111,10 +112,11 @@ async def get_resident_info_data(
user = await users_repository.get_user_by_id(resident.user_entity)
if user:
if user.username:
username = f"@{user.username}"
username = f"@{hd.quote(user.username)}"
else:
username = f"ID: {user.id}"
user_info = f"{user.first_name} ({username})"
first_name = hd.quote(user.first_name) if user.first_name else "Без имени"
user_info = f"{first_name} ({username})"
is_admin = user.is_admin
admin_badge = " 👑" if is_admin else ""