From 7f3b885521f61c099fb2c27f61f92aac2c5188c5 Mon Sep 17 00:00:00 2001 From: shoko <270575765+shokollm@users.noreply.github.com> Date: Thu, 26 Mar 2026 17:43:28 +0000 Subject: [PATCH 1/2] Fix: Event happening exactly now shows 'LIVE' instead of 'In 0m' Changed condition from total_sec < 0 to total_sec <= 0 to catch the edge case where an event is happening right now. --- skills/polymarket-browse/scripts/browse.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skills/polymarket-browse/scripts/browse.py b/skills/polymarket-browse/scripts/browse.py index 6444739..e1af87b 100644 --- a/skills/polymarket-browse/scripts/browse.py +++ b/skills/polymarket-browse/scripts/browse.py @@ -470,8 +470,8 @@ def _get_time_data(e: dict[str, Any], tz: timezone | None = None) -> TimeData: delta = start_dt - now_utc total_sec = delta.total_seconds() - if total_sec < 0: - # Event is in the past + if total_sec <= 0: + # Event is in the past or happening now hours_ago = abs(total_sec) / 3600 if hours_ago < 1: time_status = "LIVE" From 53c268511abe3a6b62f14b89cbd83004813bb9f5 Mon Sep 17 00:00:00 2001 From: shoko <270575765+shokollm@users.noreply.github.com> Date: Thu, 26 Mar 2026 17:46:53 +0000 Subject: [PATCH 2/2] Add test for event happening exactly now shows LIVE Added test_get_time_data_live_exactly_now to prevent regression. --- skills/polymarket-browse/tests/test_browse.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/skills/polymarket-browse/tests/test_browse.py b/skills/polymarket-browse/tests/test_browse.py index 1cb3b0d..397c581 100644 --- a/skills/polymarket-browse/tests/test_browse.py +++ b/skills/polymarket-browse/tests/test_browse.py @@ -309,6 +309,16 @@ class TestTimeFunctions(unittest.TestCase): self.assertEqual(td["time_urgency"], 3) self.assertIn("WIB", td["abs_time"]) + def test_get_time_data_live_exactly_now(self): + """Event starts exactly now -> 'LIVE', urgency 3 (not 'In 0m').""" + frozen = self._frozen_dt(2026, 3, 25, 12, 0, 0) + with patch("browse.datetime", self._mock_datetime(frozen)): + from browse import _get_time_data + + td = _get_time_data(self._make_event("2026-03-25T12:00:00Z")) + self.assertEqual(td["time_status"], "LIVE") + self.assertEqual(td["time_urgency"], 3) + def test_get_time_data_started_2h_ago(self): """Started 2 hours ago -> 'LIVE 2h', urgency 3.""" frozen = self._frozen_dt(2026, 3, 25, 14, 0, 0)