mirror of
https://github.com/koloideal/DutyLog.git
synced 2026-06-10 10:25:29 +03:00
update
This commit is contained in:
@@ -14,6 +14,9 @@ from dutylog.infrastructure.database.repositories.residents_repository import (
|
|||||||
from dutylog.infrastructure.database.repositories.rooms_repository import (
|
from dutylog.infrastructure.database.repositories.rooms_repository import (
|
||||||
RoomsRepository,
|
RoomsRepository,
|
||||||
)
|
)
|
||||||
|
from dutylog.infrastructure.database.repositories.users_repository import (
|
||||||
|
UsersRepository,
|
||||||
|
)
|
||||||
from dutylog.infrastructure.utils.datetime import msk_now
|
from dutylog.infrastructure.utils.datetime import msk_now
|
||||||
|
|
||||||
|
|
||||||
@@ -22,6 +25,7 @@ async def get_transactions_history_data(
|
|||||||
transactions_repository: FromDishka[HoursTransactionsRepository],
|
transactions_repository: FromDishka[HoursTransactionsRepository],
|
||||||
residents_repository: FromDishka[ResidentsRepository],
|
residents_repository: FromDishka[ResidentsRepository],
|
||||||
rooms_repository: FromDishka[RoomsRepository],
|
rooms_repository: FromDishka[RoomsRepository],
|
||||||
|
users_repository: FromDishka[UsersRepository],
|
||||||
**kwargs,
|
**kwargs,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
all_transactions = await transactions_repository.get_all_transactions()
|
all_transactions = await transactions_repository.get_all_transactions()
|
||||||
@@ -49,9 +53,16 @@ async def get_transactions_history_data(
|
|||||||
msk_time = tx.created_at.astimezone(msk_now().tzinfo).replace(tzinfo=None)
|
msk_time = tx.created_at.astimezone(msk_now().tzinfo).replace(tzinfo=None)
|
||||||
date_str = msk_time.strftime("%d.%m.%Y %H:%M")
|
date_str = msk_time.strftime("%d.%m.%Y %H:%M")
|
||||||
|
|
||||||
|
admin_info = ""
|
||||||
|
if tx.admin_id:
|
||||||
|
admin = await users_repository.get_user_by_id(tx.admin_id)
|
||||||
|
if admin:
|
||||||
|
admin_name = f"@{admin.username}" if admin.username else admin.first_name or f"ID: {admin.id}"
|
||||||
|
admin_info = f"\n👨💼 {admin_name}"
|
||||||
|
|
||||||
remark_text = f"\n💬 <i>{tx.remark}</i>" if tx.remark else ""
|
remark_text = f"\n💬 <i>{tx.remark}</i>" if tx.remark else ""
|
||||||
|
|
||||||
content += f"<blockquote><b>{operation}</b> {emoji}<code>{tx.amount}</code> ч{room_mark}\n👤 {resident.real_name or 'Без имени'} (к. {room_number})\n📅 {date_str}{remark_text}</blockquote>\n"
|
content += f"<blockquote><b>{operation}</b> {emoji}<code>{tx.amount}</code> ч{room_mark}\n👤 {resident.real_name or 'Без имени'} (к. {room_number}){admin_info}\n📅 {date_str}{remark_text}</blockquote>\n"
|
||||||
|
|
||||||
return {"content": content}
|
return {"content": content}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user