feat: rebuild CSP practice workflow, UX and automation

这个提交包含在:
Codex CLI
2026-02-13 15:49:05 +08:00
父节点 d33deed4c5
当前提交 e2ab522b78
修改 105 个文件,包含 15669 行新增428 行删除

查看文件

@@ -19,6 +19,10 @@ Json::Value ToJson(const Problem& p) {
j["statement_md"] = p.statement_md;
j["difficulty"] = p.difficulty;
j["source"] = p.source;
j["statement_url"] = p.statement_url;
j["llm_profile_json"] = p.llm_profile_json;
j["sample_input"] = p.sample_input;
j["sample_output"] = p.sample_output;
j["created_at"] = Json::Int64(p.created_at);
return j;
}
@@ -28,11 +32,18 @@ Json::Value ToJson(const Submission& s) {
j["id"] = Json::Int64(s.id);
j["user_id"] = Json::Int64(s.user_id);
j["problem_id"] = Json::Int64(s.problem_id);
if (s.contest_id.has_value()) {
j["contest_id"] = Json::Int64(*s.contest_id);
} else {
j["contest_id"] = Json::nullValue;
}
j["language"] = ToString(s.language);
j["status"] = ToString(s.status);
j["score"] = s.score;
j["time_ms"] = s.time_ms;
j["memory_kb"] = s.memory_kb;
j["compile_log"] = s.compile_log;
j["runtime_log"] = s.runtime_log;
j["created_at"] = Json::Int64(s.created_at);
return j;
}
@@ -51,4 +62,42 @@ Json::Value ToJson(const WrongBookItem& w) {
return j;
}
Json::Value ToJson(const Contest& c) {
Json::Value j;
j["id"] = Json::Int64(c.id);
j["title"] = c.title;
j["starts_at"] = Json::Int64(c.starts_at);
j["ends_at"] = Json::Int64(c.ends_at);
j["rule_json"] = c.rule_json;
return j;
}
Json::Value ToJson(const KbArticle& a) {
Json::Value j;
j["id"] = Json::Int64(a.id);
j["slug"] = a.slug;
j["title"] = a.title;
j["content_md"] = a.content_md;
j["created_at"] = Json::Int64(a.created_at);
return j;
}
Json::Value ToJson(const GlobalLeaderboardEntry& e) {
Json::Value j;
j["user_id"] = Json::Int64(e.user_id);
j["username"] = e.username;
j["rating"] = e.rating;
j["created_at"] = Json::Int64(e.created_at);
return j;
}
Json::Value ToJson(const ContestLeaderboardEntry& e) {
Json::Value j;
j["user_id"] = Json::Int64(e.user_id);
j["username"] = e.username;
j["solved"] = e.solved;
j["penalty_sec"] = Json::Int64(e.penalty_sec);
return j;
}
} // namespace csp::domain