browse.py has 3 duplicate time functions doing similar things #15

Closed
opened 2026-03-25 10:48:03 +01:00 by shoko · 0 comments
Owner

The file skills/polymarket-browse/scripts/browse.py contains three functions that parse event timestamps and return formatted time strings:

  1. get_match_time_status(e) (line 222) - Returns (status_str, urgency) where urgency is 0-3
  2. get_match_time_str(e) (line 272) - Returns just the time status string (e.g. "LIVE", "In 6h")
  3. get_start_time_wib(e) (line 417) - Returns (date_time_str, relative_str) with absolute WIB time and relative time

All three functions:

  • Extract startTime or startDate from the event
  • Parse the ISO timestamp
  • Calculate time delta from now
  • Return a formatted time string

This is classic code duplication. They should be consolidated into a single function that returns all needed time information (absolute time, relative string, and urgency level).

Suggested fix: Create a single unified time function that returns a dict or tuple with all time-related data, and have the existing functions call it. This would make the code more maintainable and ensure consistent time handling.

The file `skills/polymarket-browse/scripts/browse.py` contains three functions that parse event timestamps and return formatted time strings: 1. `get_match_time_status(e)` (line 222) - Returns `(status_str, urgency)` where urgency is 0-3 2. `get_match_time_str(e)` (line 272) - Returns just the time status string (e.g. "LIVE", "In 6h") 3. `get_start_time_wib(e)` (line 417) - Returns `(date_time_str, relative_str)` with absolute WIB time and relative time All three functions: - Extract `startTime` or `startDate` from the event - Parse the ISO timestamp - Calculate time delta from now - Return a formatted time string This is classic code duplication. They should be consolidated into a single function that returns all needed time information (absolute time, relative string, and urgency level). **Suggested fix**: Create a single unified time function that returns a dict or tuple with all time-related data, and have the existing functions call it. This would make the code more maintainable and ensure consistent time handling.
shoko added the enhancement label 2026-03-25 10:48:20 +01:00
shoko added the high label 2026-03-25 13:28:04 +01:00
shoko closed this issue 2026-03-25 15:34:13 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/jujutsu-skills#15