This commit is contained in:
2026-02-28 11:48:31 +03:00
parent 3c0d50a1aa
commit 29504c5502
4 changed files with 255 additions and 14 deletions
@@ -81,9 +81,9 @@ async def get_main_menu_data(
⏰ <b>Ваши часы дежурств</b>
<blockquote>🟢 <b>Отработанные часы:</b> <code>{resident.active_hours}</code> ч
<blockquote>🟢 <b>Отработанные часы:</b> <code>{resident.inactive_hours}</code> ч
━━━━━━━━━━━━━━━━
🔴 Неотработанные часы: <code>{resident.inactive_hours}</code> ч</blockquote>
🔴 Неотработанные часы: <code>{resident.active_hours}</code> ч</blockquote>
"""
has_resident = True
else:
@@ -120,7 +120,8 @@ async def get_history_data(
"""
else:
transactions = await transactions_repository.get_resident_history(resident.id)
last_10 = transactions[:10]
transactions_sorted = sorted(transactions, key=lambda x: x.created_at)
last_10 = transactions_sorted[:10]
if not last_10:
history_text = """
@@ -131,7 +132,7 @@ async def get_history_data(
else:
history_lines = []
for tx in last_10:
emoji = "" if tx.transaction_type == "increase" else ""
emoji = "+" if tx.transaction_type == "increase" else "-"
date_str = tx.created_at.strftime("%d.%m.%Y %H:%M")
history_lines.append(
f"{emoji} <code>{tx.amount}</code> ч • <i>{date_str}</i>"