remove contests.json

This commit is contained in:
hanyixuanten
2026-07-20 20:51:36 +08:00
parent 181b947fe9
commit 05be0be1db
7 changed files with 214 additions and 227 deletions
+5 -7
View File
@@ -4,10 +4,10 @@ Guidance for AI coding agents working in this repository.
## Project Shape
- `fetch_contests.py` is the data generator. It fetches contests, normalizes records with `platform`, `title`, `start_time`, `end_time`, `status`, and `url`, then writes JSON files in the repository root.
- `fetch_contests.py` is the data generator. It fetches contests, normalizes records with `platform`, `title`, `start_time`, `end_time`, `status`, and `url`, then writes `contests_all.json` in the repository root.
- Current contest providers are Codeforces, AtCoder, UOJ, and Nowcoder.
- `.github/workflows/deploy.yml` is the GitHub Actions automation. It installs Python dependencies, runs `fetch_contests.py`, and commits generated JSON changes.
- `server/index.php` is the serving/display layer. It reads the public raw `contests.json` and `contests_all.json`, caches them locally, and renders upcoming plus recently finished contests.
- `server/index.php` is the serving/display layer. It reads the public raw `contests_all.json`, caches it locally, and renders upcoming plus recently finished contests.
- User-facing documentation lives in [README.md](README.md) and [README_zh.md](README_zh.md). Keep both languages in sync.
## Actions vs Server Responsibilities
@@ -23,7 +23,7 @@ Guidance for AI coding agents working in this repository.
When adding a new contest provider, check all relevant surfaces:
- `fetch_contests.py`: add a `fetch_<provider>()` function, normalize records through `make_contest()`, add it to both output flows in `main()`, and preserve `status` semantics.
- `server/index.php`: add the platform name to `$platform_class` and define a matching `.platform.<class>` CSS rule if the provider appears in `contests.json`.
- `server/index.php`: add the platform name to `$platform_class` and define a matching `.platform.<class>` CSS rule if the provider appears in `contests_all.json`.
- `README.md` and `README_zh.md`: update supported platforms, data-source notes, and any changed usage/output details.
- `AGENTS.md`: update this guidance if the provider introduces a new pattern, dependency, output contract, or operational caveat.
- `.github/workflows/deploy.yml`: update only if the provider needs new Python dependencies, generated files, secrets, or schedule behavior.
@@ -32,8 +32,7 @@ When removing a provider, remove or adjust the same surfaces so stale platform l
## Output Contracts
- `contests.json` is an object with `generated_at` and `contests`; `contests` contains contests that have not ended yet: `upcoming` and `running`.
- `contests_all.json` is an object with `generated_at` and `contests`; `contests` contains contests that finished within the last 30 days.
- `contests_all.json` is an object with `generated_at` and `contests`; `contests` contains contests that have not ended yet (`upcoming` and `running`) plus contests that finished within the last 30 days.
- JSON timestamps are Unix timestamps in seconds.
- Keep record keys stable unless the README files and server rendering are updated in the same change.
@@ -50,11 +49,10 @@ python fetch_contests.py
Then inspect the generated files with `jq` when available, for example:
```bash
jq '.contests | group_by(.platform) | map({platform: .[0].platform, count: length})' contests.json
jq '.contests | group_by(.status) | map({status: .[0].status, count: length})' contests_all.json
```
For PHP-only presentation changes, also check that `server/index.php` still reads `contests.json` and handles unknown platforms with the default styling.
For PHP-only presentation changes, also check that `server/index.php` still reads `contests_all.json` and handles unknown platforms with the default styling.
## Documentation Rule