From 15e3121d55174794e83bdf93433f6456af13cf3f Mon Sep 17 00:00:00 2001 From: Rene Arumetsa Date: Mon, 11 May 2026 22:28:21 +0300 Subject: [PATCH] Fix birthday bug --- commands/dev_member_commands.py | 2 +- commands/dev_member_runtime.py | 2 +- core/member_sync.py | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/commands/dev_member_commands.py b/commands/dev_member_commands.py index 9d44b8c..aea4521 100644 --- a/commands/dev_member_commands.py +++ b/commands/dev_member_commands.py @@ -236,7 +236,7 @@ def register_dev_member_commands( else: already_ok += 1 - if result.birthday_soon and not has_announced_today(member.id): + if result.birthday_today and not has_announced_today(member.id): birthday_pings += 1 await announce_birthday(member, bot) mark_announced_today(member.id) diff --git a/commands/dev_member_runtime.py b/commands/dev_member_runtime.py index 71b1510..7e3953e 100644 --- a/commands/dev_member_runtime.py +++ b/commands/dev_member_runtime.py @@ -88,6 +88,6 @@ async def handle_member_join( log_sync_result(member, result) await sheets.set_synced(member.id, result.synced) - if result.birthday_soon and not has_announced_today(member.id): + if result.birthday_today and not has_announced_today(member.id): await announce_birthday(member, bot) mark_announced_today(member.id) diff --git a/core/member_sync.py b/core/member_sync.py index a9c9766..9e28070 100644 --- a/core/member_sync.py +++ b/core/member_sync.py @@ -34,6 +34,7 @@ class SyncResult: roles_added: list[str] = field(default_factory=list) roles_removed: list[str] = field(default_factory=list) birthday_soon: bool = False + birthday_today: bool = False not_found: bool = False errors: list[str] = field(default_factory=list) synced: bool = False # True when no errors; caller writes this to the sheet @@ -186,8 +187,9 @@ async def sync_member( # --- Birthday check --- birthday_str = str(row.get("Sünnipäev", "")).strip() - if not _is_placeholder(birthday_str) and _is_birthday_soon(birthday_str): - result.birthday_soon = True + if not _is_placeholder(birthday_str): + result.birthday_today = is_birthday_today(birthday_str) + result.birthday_soon = _is_birthday_soon(birthday_str) # --- Mark synced (caller is responsible for writing to sheet) --- result.synced = not bool(result.errors)