From e8c2a3a299f8552d243ff54f3606749a923d8618 Mon Sep 17 00:00:00 2001 From: redreceipt Date: Mon, 15 Jun 2026 17:53:13 -0400 Subject: [PATCH] fix project update date labels --- jobs.py | 4 +++- tests/test_jobs.py | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/jobs.py b/jobs.py index 001fd83..b1b300a 100644 --- a/jobs.py +++ b/jobs.py @@ -681,6 +681,8 @@ def post_project_updates(): target_label = ( target_status_text if target_status_text.endswith("overdue") + else "Today" + if days_left == 0 else _format_short_weekday(target_dt) ) line = f"- <{url}|{name}> - {target_label} - Lead: {lead_md}" @@ -694,7 +696,7 @@ def post_project_updates(): start_dt = parse_iso_date(project.get("startDate")) if start_dt: days_until_start = (start_dt - today).days - if 0 <= days_until_start <= 3: + if 1 <= days_until_start <= 3: starting_soon.append( { "name": name, diff --git a/tests/test_jobs.py b/tests/test_jobs.py index b4f18cd..386492d 100644 --- a/tests/test_jobs.py +++ b/tests/test_jobs.py @@ -715,6 +715,14 @@ def test_groups_overdue_ending_soon_and_starting_soon_in_order(self): "status": {"name": "Active"}, "lead": {"displayName": "Alex"}, }, + # Ending today should use a relative label. + { + "name": "Ending Today", + "url": "https://linear.app/project/ending-today", + "targetDate": "2026-03-15", + "status": {"name": "Active"}, + "lead": {"displayName": "Alex"}, + }, # Ending soon (within 3 days) { "name": "Ending Tue", @@ -739,6 +747,14 @@ def test_groups_overdue_ending_soon_and_starting_soon_in_order(self): "status": {"name": "Active"}, "lead": {"displayName": "Alex"}, }, + # Starting today should not be in starting soon. + { + "name": "Starting Today", + "url": "https://linear.app/project/starting-today", + "startDate": "2026-03-15", + "status": {"name": "Planned"}, + "lead": {"displayName": "Alex"}, + }, # Starting soon (within 3 days) { "name": "Starting Tue", @@ -838,11 +854,16 @@ def test_groups_overdue_ending_soon_and_starting_soon_in_order(self): # Correct projects present self.assertIn("Late Alpha", message) + self.assertIn("Ending Today", message) self.assertIn("Ending Tue", message) self.assertIn("Ending Wed", message) self.assertIn("Starting Tue", message) self.assertIn("Starting Wed", message) self.assertIn("Lead: <@U1>", message) + self.assertIn( + "- - Today - Lead: <@U1>", + message, + ) self.assertIn( "- - Tue - Lead: <@U1>", message ) @@ -860,6 +881,7 @@ def test_groups_overdue_ending_soon_and_starting_soon_in_order(self): # Correct projects filtered out self.assertNotIn("Ending Far", message) + self.assertNotIn("Starting Today", message) self.assertNotIn("Starting Far", message) self.assertNotIn("Canceled Start", message) self.assertNotIn("Completed Start", message)