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
|
|
@ -228,9 +228,13 @@ class CSESScraper(BaseScraper):
|
|||
cats = parse_categories(html)
|
||||
if not cats:
|
||||
return ContestListResult(
|
||||
success=False, error=f"{self.platform_name}: No contests found"
|
||||
success=False,
|
||||
error=f"{self.platform_name}: No contests found",
|
||||
supports_countdown=False,
|
||||
)
|
||||
return ContestListResult(success=True, error="", contests=cats)
|
||||
return ContestListResult(
|
||||
success=True, error="", contests=cats, supports_countdown=False
|
||||
)
|
||||
|
||||
async def login(self, credentials: dict[str, str]) -> LoginResult:
|
||||
username = credentials.get("username", "")
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ class MetadataResult(ScrapingResult):
|
|||
|
||||
class ContestListResult(ScrapingResult):
|
||||
contests: list[ContestSummary] = Field(default_factory=list)
|
||||
supports_countdown: bool = True
|
||||
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
|
|
|
|||
|
|
@ -337,10 +337,16 @@ class USACOScraper(BaseScraper):
|
|||
contests.extend(await coro)
|
||||
|
||||
if not contests:
|
||||
return self._contests_error("No contests found")
|
||||
return ContestListResult(success=True, error="", contests=contests)
|
||||
return ContestListResult(
|
||||
success=False, error="No contests found", supports_countdown=False
|
||||
)
|
||||
return ContestListResult(
|
||||
success=True, error="", contests=contests, supports_countdown=False
|
||||
)
|
||||
except Exception as e:
|
||||
return self._contests_error(str(e))
|
||||
return ContestListResult(
|
||||
success=False, error=str(e), supports_countdown=False
|
||||
)
|
||||
|
||||
async def stream_tests_for_category_async(self, category_id: str) -> None:
|
||||
month_year, division = _parse_contest_id(category_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue