feat: race countdown support and language version selection (#346)
## Problem Two gaps in the plugin: (1) contest pickers have no way to know whether a contest supports countdown (race), so the UI can't surface that affordance; (2) `:CP submit` hardcodes a single language ID per platform with no way to choose C++ standard or override the platform ID. ## Solution **Race countdown** (`4e709c8`): Add `supports_countdown` boolean to `ContestListResult` and wire it through CSES/USACO scrapers, cache, race module, and pickers. **Language version selection** (`b90ac67`): Add `LANGUAGE_VERSIONS` and `DEFAULT_VERSIONS` tables in `constants.lua`. Config gains `version` and `submit_id` fields validated at setup time. `submit.lua` resolves the effective config to a platform ID (priority: `submit_id` > `version` > default). Helpdocs add `*cp-submit-language*` section. Tests cover `LANGUAGE_IDS` completeness.
This commit is contained in:
parent
592f977296
commit
58b6840815
13 changed files with 265 additions and 46 deletions
|
|
@ -392,7 +392,8 @@ end
|
|||
|
||||
---@param platform string
|
||||
---@param contests ContestSummary[]
|
||||
function M.set_contest_summaries(platform, contests)
|
||||
---@param opts? { supports_countdown?: boolean }
|
||||
function M.set_contest_summaries(platform, contests, opts)
|
||||
cache_data[platform] = cache_data[platform] or {}
|
||||
for _, contest in ipairs(contests) do
|
||||
cache_data[platform][contest.id] = cache_data[platform][contest.id] or {}
|
||||
|
|
@ -405,9 +406,22 @@ function M.set_contest_summaries(platform, contests)
|
|||
end
|
||||
end
|
||||
|
||||
if opts and opts.supports_countdown ~= nil then
|
||||
cache_data[platform].supports_countdown = opts.supports_countdown
|
||||
end
|
||||
|
||||
M.save()
|
||||
end
|
||||
|
||||
---@param platform string
|
||||
---@return boolean?
|
||||
function M.get_supports_countdown(platform)
|
||||
if not cache_data[platform] then
|
||||
return nil
|
||||
end
|
||||
return cache_data[platform].supports_countdown
|
||||
end
|
||||
|
||||
---@param platform string
|
||||
---@param contest_id string
|
||||
---@return integer?
|
||||
|
|
@ -418,6 +432,16 @@ function M.get_contest_start_time(platform, contest_id)
|
|||
return cache_data[platform][contest_id].start_time
|
||||
end
|
||||
|
||||
---@param platform string
|
||||
---@param contest_id string
|
||||
---@return string?
|
||||
function M.get_contest_display_name(platform, contest_id)
|
||||
if not cache_data[platform] or not cache_data[platform][contest_id] then
|
||||
return nil
|
||||
end
|
||||
return cache_data[platform][contest_id].display_name
|
||||
end
|
||||
|
||||
---@param platform string
|
||||
---@return table?
|
||||
function M.get_credentials(platform)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue