Commit Graph
100 Commits
Author SHA1 Message Date
xuyueandClaude Opus 5 562cf4f0b4 fix(plan): 隐藏成就的条件字段也必须遮码
只遮名称和描述、却明文下发 metric/operator/threshold,
学生打开 DevTools 就能看到达成条件,隐藏成就失去意义。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 01:14:07 -06:00
xuyue 1d66e2be1f feat(achievement): 添加用户侧成就 API
新增 achievements 列表、summary、pending 三个用户侧端点,隐藏未解锁成就
在序列化层打码(name/description/icon 替换为占位符,不下发 progress)。
2026-08-04 01:12:16 -06:00
xuyue 8ce3660c87 fix(achievement): 元指标回写改为重新取锁重读,避免丢失更新 2026-08-04 01:08:06 -06:00
xuyueandClaude Opus 5 73789bda0c fix(plan): 修正元指标回写的丢失更新缺陷
第二轮 stat.save() 在锁外整体写回解锁前的快照,
并发判题时会覆盖掉另一条链路刚提交的指标增量。
改为重新取锁、重读、只合并元指标的 key。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 01:07:21 -06:00
xuyue 95bf02efbd feat(achievement): 添加判定核心、通知模块并接入判题链路 2026-08-04 01:02:29 -06:00
xuyueandClaude Opus 5 9e0bc1fa8c fix(plan): 修正 unlock() 的并发重复计数缺陷
bulk_create(ignore_conflicts=True) 无法区分新建与已存在,
并发判题时会重复累加 unlock_count 并重复推送通知。
改为逐条 get_or_create,以 was_created 为唯一判据。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 00:59:49 -06:00
xuyueandClaude Opus 5 c1081e6193 fix(achievement): 指标的 AC 口径改用 is_accepted,与全项目一致
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 00:56:32 -06:00
xuyueandClaude Opus 5 d9840910e6 feat(achievement): 添加指标注册表与 16 个内置指标
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 00:49:49 -06:00
xuyue 456c435289 feat(achievement): 添加成就系统数据模型 2026-08-04 00:44:35 -06:00
xuyueandClaude Opus 5 d4d700782b docs: 成就系统实施计划
13 个任务、75 个步骤,覆盖后端 app、指标注册表、判定任务、
用户与管理 API、重算命令、题单奖章接入,以及前端奖杯馆、
全局弹窗、炫耀入口和管理配置页。

按项目规定不含测试步骤,每个任务以可执行的验证命令替代。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 00:03:02 -06:00
xuyueandClaude Opus 5 8d9dc7b521 docs: 修订成就系统设计,修复对现有代码的错误假设
- 解锁通知改推拉结合:WebSocket 非常驻连接,纯推会丢消息,
  以 UserAchievement.notified + pending 端点为主通道
- 记录 push_to_user 复用 submission_update handler 的冲突,
  useSubmissionMonitor 需按 type 过滤
- 定义 achievement_unlocked_count 元指标及两轮判定上限,解决自引用
- 明确比赛提交不计入成就(contest_joined 除外)
- 判定任务投递点精确到 judge_task 末尾,避免漏掉比赛分支
- 移除无用例的 eq operator

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-03 23:51:08 -06:00
xuyueandClaude Opus 5 c51e9332d1 docs: 成就系统设计方案
日式游戏风格的全站成就系统设计:代码注册指标、后台配置条件、
判题后异步判定、前端奖杯馆。与现有题单奖章分层共存。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-03 23:46:55 -06:00
xuyue 75ff10d9fe fix 2026-07-26 07:21:56 -06:00
xuyue 224960ac0f fix 2026-07-26 07:20:16 -06:00
xuyue 66fac1f66d update 2026-07-05 03:12:34 -06:00
xuyue 70fed2d15d fix 2026-07-05 01:33:33 -06:00
xuyueandClaude Opus 4.8 10af0256b8 移除 OI 残留:UserProfile 的 oi_problems_status / total_score / add_score
判题不再写入 OI 相关状态后,UserProfile 上的 OI 字段永远为空/为 0:
- 删除 oi_problems_status、total_score 两列及 add_score() 方法
- ProfileProblemDisplayIDRefreshAPI 去掉 oi_problems 合并分支

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 11:40:45 -06:00
xuyueandClaude Opus 4.8 9535b64a4b 精简 Problem 模型:移除 rule_type / total_score / io_mode
系统只用 ACM 模式且题目固定标准 IO,这三列已无实际用途:
- rule_type / total_score:OI 专用,删除后 judge/dispatcher 的 OI 分支全部塌缩为 ACM
- io_mode:判题改为固定发送 Standard IO 常量;languages.py 的 seccomp_rule
  保留 dict 形态但改用字面量 key,不改判题机 wire 契约
- prompt 字段保留(预留给未来 AI 分析)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 11:40:38 -06:00
xuyue 4743b0398a update 2026-07-04 11:07:24 -06:00
xuyueandClaude Fable 5 deae73cd88 feat: SQL 题测试点脚本回显接口
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 19:29:51 -06:00
xuyueandClaude Fable 5 803d6ca58d feat: SQL 题测试点预览接口
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 19:25:47 -06:00
xuyue f77b98d4d7 fix 2026-07-03 18:34:12 -06:00
xuyue fc09d291a7 fix 2026-07-03 18:28:25 -06:00
xuyue 979c709333 fix 2026-07-03 18:19:16 -06:00
xuyueandClaude Fable 5 16ec78beae feat: SQL 提交前自动格式化(sqlparse)
- format_code 新增 sql 分支,reindent + 关键字大写
- FormatCodeSerializer 的 language choices 加入 sql

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 10:05:38 -06:00
xuyueandClaude Fable 5 2ec036ac37 feat: 新增 rebuild_sql_display 管理命令,为存量 SQL 题回填展示数据
生成逻辑从 ProblemBase._build_sql_display 提取为 problem.utils.generate_sql_display,
管理端保存与回填命令共用。命令支持 --dry-run / --force。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 09:42:11 -06:00
xuyueandClaude Fable 5 5af9d67fe2 fix: 终审修复——test_case_id 格式校验、modify 空变更报错、异常兜底与文档补充
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 06:26:00 -06:00
xuyueandClaude Fable 5 67079b5304 fix: _build_sql_display 兜底 info 结构损坏,避免 KeyError 导致 500
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 01:22:27 -06:00
xuyueandClaude Fable 5 06642b8131 feat: 保存 SQL 题时自动生成 sql_display 展示数据
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 01:15:58 -06:00
xuyueandClaude Fable 5 90531720bb fix: build_display modify 模式补齐被 DROP 的表条目
标准答案 DROP 表后该表不在 sqlite_master 中,changed_tables 会静默
遗漏;用初始展示数据补齐并标记 dropped=True。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 01:10:04 -06:00
xuyueandClaude Fable 5 09501469e2 feat: SQL 题展示数据生成 build_display
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 01:01:32 -06:00
xuyueandClaude Fable 5 caec69c809 docs: SQL 题数据化展示实施计划
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 00:56:10 -06:00
xuyueandClaude Fable 5 e244030e7a docs: SQL 题数据化展示设计文档
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 00:49:03 -06:00
xuyue 1e6041d13d fix 2026-07-02 19:16:09 -06:00
xuyueandClaude Fable 5 9f7f818d51 新增 SQL 题型:SQLite 内联判题(不依赖外部沙箱)
- SQL 作为语言接入现有提交流程,judge_task 按 language 分流到 SQLJudgeDispatcher
- judge/sql_runner.py:内存 SQLite 判题核心,查询题比结果集/增删改题比表状态,
  authorizer + progress_handler + max_page_count 三重防护
- dispatcher 提取 _process_judge_result/_push_status 供 SQL 判题复用(行为不变)
- 测试点通道支持 1.sql..N.sql 压缩包,出题只需数据脚本+标准答案
- Problem 增加 sql_config 字段;options 数据迁移注册 SQL 语言

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 17:23:13 -06:00
xuyue d1a1c05b9f add new type of self-learning 2026-06-29 19:37:59 -06:00
xuyue 180d75cb97 fix 2026-06-29 06:41:18 -06:00
xuyue c1ec9eab8f update 2026-06-14 09:43:33 -06:00
xuyue 124a1d84d3 update 2026-06-14 09:42:25 -06:00
xuyue 9949ebf1c5 fix 2026-06-14 09:27:21 -06:00
xuyue 90d1a2aa30 fix 2026-06-14 09:19:01 -06:00
xuyue dab6734d03 switch docker image 2026-06-14 09:13:05 -06:00
xuyue fa6736b855 docs: design Debian slim backend image 2026-06-14 09:08:36 -06:00
xuyueandClaude Sonnet 4.6 322acc543f build: install clang-extra-tools for clang-format in backend image
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 08:07:50 -06:00
xuyueandClaude Sonnet 4.6 7974d12475 build: move ruff from dev to main dependencies (needed at runtime for code formatting)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 08:05:12 -06:00
xuyueandClaude Sonnet 4.6 f7fbfdba7d fix(submission): revert unnecessary CSRF exemption on FormatCodeAPI
The CSRF 403 error was expected Django behavior (no CSRF cookie in curl).
FormatCodeAPI should follow SubmissionAPI's pattern (APIView, not CSRF-exempt).
Verified with GET request: /api/format_code returns 405 (correct route resolution).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 08:02:06 -06:00
xuyueandClaude Sonnet 4.6 5cc5c64625 feat(submission): register /api/format_code route and fix CSRF exemption
Task 4: Register the FormatCodeAPI view to the /api/format_code endpoint.

Also fix: Make FormatCodeAPI extend CSRFExemptAPIView instead of APIView
so that the manual verification curl commands receive JSON responses
(login-required error) instead of HTML 403 Forbidden responses. This is
necessary for the view to work with the @login_required decorator which
expects to return JSON errors, not be blocked by CSRF middleware.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 07:57:24 -06:00
xuyue be1610faa6 feat(submission): add FormatCodeAPI view 2026-06-14 07:51:41 -06:00
xuyueandClaude Sonnet 4.6 bfeb69434e feat(submission): add FormatCodeSerializer
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 07:48:58 -06:00
xuyue 4cd37cef78 feat(submission): add ruff/clang-format code formatting helper 2026-06-14 07:46:41 -06:00
xuyueandClaude Sonnet 4.6 69eb15ac27 Add implementation plan for pre-submit code auto-formatting
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 07:43:51 -06:00
xuyueandClaude Sonnet 4.6 1bbc149e55 Add design spec for pre-submit code auto-formatting
Plan: ruff for Python3, clang-format (LLVM/4-space/Attach) for C/C++,
called via new /api/format_code endpoint before submission.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 07:41:03 -06:00
xuyue 95949e565c update 2026-06-09 05:04:43 -06:00
xuyue 69bd6af6ec update 2026-06-05 09:58:52 -06:00
xuyue d7e04adf07 fix 2026-06-05 09:46:49 -06:00
xuyue 2b65acf91a update 2026-06-05 08:51:57 -06:00
xuyue 84e972b174 update 2026-06-05 00:58:51 -06:00
xuyue 6a7be0e97a fix 2026-06-04 23:59:20 -06:00
xuyue 513743c767 update 2026-06-04 08:44:58 -06:00
xuyue 6a870875ee add ai report 2026-06-04 08:06:31 -06:00
xuyue 3d5ace65f2 feat: register ai admin URL routes 2026-06-04 07:31:14 -06:00
xuyue baed3b80f1 feat: add AIAnalysisAdminAPI for listing and reading reports 2026-06-04 07:27:24 -06:00
xuyue 39f1e8b35e fix: use utils.api serializers import instead of rest_framework directly 2026-06-04 07:26:08 -06:00
xuyue f8cbcf28c1 feat: add AIAnalysis serializers for admin list/detail 2026-06-04 07:25:45 -06:00
xuyue b28301bbb1 fix 2026-06-04 05:31:23 -06:00
xuyue f6e41dc349 fix 2026-06-04 04:48:25 -06:00
xuyue 745ddb56f9 fix 2026-06-03 07:38:07 -06:00
xuyue 734f596e1a update 2026-06-03 07:29:03 -06:00
xuyue 0764946c17 add wc 2026-06-03 07:19:57 -06:00
xuyue 809673e64f fix 2026-06-03 04:50:46 -06:00
xuyue 59dbb6868f update 2026-06-03 00:01:29 -06:00
xuyue d1fdbcf52b fix 2026-06-02 23:13:06 -06:00
xuyueandClaude Opus 4.6 385d04505b feat: open teaching analytics to Teacher Admin
StuckProblems, TopACTrend, AI user analysis, and problemset user
progress are now accessible to Teacher Admin (previously super-only).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-02 18:17:26 -06:00
xuyueandClaude Opus 4.6 f94d29cf93 feat: add Teacher Admin role to four-tier permission system
Introduces a four-tier role system: Regular User → Student Admin →
Teacher Admin → Super Admin. Teacher Admin can manage own contests,
problemsets, and view classroom data. Student Admin (renamed from Admin)
retains problem management only.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-02 18:13:33 -06:00
xuyue 125d57b123 update 2026-06-02 10:48:24 -06:00
xuyue fd7384980a update 2026-05-28 19:13:14 -06:00
xuyue 6ab2886f77 remove contest type 2026-05-26 23:10:27 -06:00
xuyue 6b81856bfd refactor: replace sync_to_async aggregate with aaggregate in problemset views 2026-05-26 21:48:30 -06:00
xuyue 48a16d91b5 refactor: replace sync_to_async aggregate with aaggregate in problem views 2026-05-26 21:46:56 -06:00
xuyue b041de8c4a refactor: replace sync_to_async aggregate with aaggregate in CommentStatisticsAPI 2026-05-26 21:44:56 -06:00
xuyue e47923758e refactor: replace sync_to_async queryset slice with async for comprehension 2026-05-26 21:42:43 -06:00
xuyue c49a6af066 refactor: replace sync_to_async cache wrappers with native cache.aget/aset/adelete 2026-05-26 21:25:48 -06:00
xuyue 57c0572fd9 async 2026-05-26 21:25:26 -06:00
xuyue 8731012f47 use asgi 2026-05-26 07:37:05 -06:00
xuyue 759593a224 fix 2026-05-26 07:08:23 -06:00
xuyue 1217ee3eaf update 2026-05-26 02:19:26 -06:00
xuyue bf2a95ef01 update 2026-05-25 23:55:19 -06:00
xuyue 1498e1046f fix 2026-05-25 23:06:01 -06:00
xuyue 92eeb91fd7 update 2026-05-25 22:58:43 -06:00
xuyue 92bc3ac221 update 2026-05-25 22:40:22 -06:00
xuyue c6b368dc82 update 2026-05-25 22:24:53 -06:00
xuyue ed8a2f575f update 2026-05-25 21:57:38 -06:00
xuyue 2e7c6fb404 update 2026-05-25 21:56:11 -06:00
xuyue 4187fe6891 feat: update ai/views/oj.py query filters to treat AST_CHECK_FAILED as accepted 2026-05-25 20:46:11 -06:00
xuyueandClaude Sonnet 4.6 980b803517 feat: update all query filters to treat AST_CHECK_FAILED as accepted
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 20:45:15 -06:00
xuyueandClaude Sonnet 4.6 4d7eabd607 feat: integrate AST check into JudgeDispatcher with is_accepted() statistics
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 20:42:45 -06:00
xuyue dab36f35c4 feat: add check_ast entry point 2026-05-25 20:40:13 -06:00
xuyue 811b065e05 feat: add AST checker engine framework with 9 Phase 1 engines 2026-05-25 20:39:31 -06:00
xuyueandClaude Sonnet 4.6 c36e6623bd feat: add AST_CHECK_FAILED status, is_accepted helper, ast_rules field
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 20:37:58 -06:00
xuyue 3b4dfe2fe2 feat: add ast_checker mappings for Python3 and C 2026-05-25 20:35:56 -06:00