feat(race): add supports_countdown to ContestListResult
Problem: `:CP race` on platforms without future contests (CSES, USACO) wastes time fetching the full contest list only to discover there is no `start_time`. The error message is also uninformative. Solution: Add `supports_countdown` bool to `ContestListResult` (default `True`). CSES and USACO set it to `False`. Cache the flag per-platform so subsequent calls skip the fetch entirely. `race.lua` checks the cached value first, then the scraper result, and shows `"<Platform> does not support :CP race"` instead of a generic error.
This commit is contained in:
parent
592f977296
commit
4e709c8470
7 changed files with 62 additions and 16 deletions
|
|
@ -48,8 +48,10 @@ function M.get_platform_contests(platform, refresh)
|
|||
{ level = vim.log.levels.INFO, override = true, sync = true }
|
||||
)
|
||||
|
||||
local contests = scraper.scrape_contest_list(platform)
|
||||
cache.set_contest_summaries(platform, contests)
|
||||
local result = scraper.scrape_contest_list(platform)
|
||||
local contests = result and result.contests or {}
|
||||
local sc = result and result.supports_countdown
|
||||
cache.set_contest_summaries(platform, contests, { supports_countdown = sc })
|
||||
picker_contests = cache.get_contest_summaries(platform)
|
||||
|
||||
logger.log(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue