Commit Graph

239 Commits

Author SHA1 Message Date
625f2466e5 refactor: 统一用户名的 ks 班级前缀处理
同一个剥前缀函数在 submission 和 flowchart 的管理端各有一份逐字相同的
拷贝,conf 里还有一份内联写法,合并到 utils/shortcuts.strip_class_prefix。

改名是因为原名 get_real_name 和 UserProfile.real_name 字段、以及三个
serializer 里的同名方法都容易混。

行为上修了两处:

- 剥前缀改用 removeprefix,不再按长度硬切。班级号对不上时原样返回,
  旧写法会从中间截出乱码(ks999王五 配 class_name=251 会切成「王五」)
- get_class_name 的正则从 \d+ 收紧到 \d{3,4},与前端
  ButtonWithSearch 的 /^ks\d{3,4}/ 对齐。旧的贪婪匹配在姓名部分是纯
  数字时会吃掉整串(ks251001 返回 251001 而不是 251)。顺带 re.search
  换成 re.match,外层的 startswith 判断并进正则

正常数据(ks251张三、ks2510李四)新旧结果一致,已逐例对拍。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-05 23:58:13 -06:00
12c12b1840 refactor(submission): 删掉提交接口里走不到的验证码分支
captcha 在 CreateSubmissionSerializer 里是 required=False,视图里只有
data.get("captcha") 为真才校验,而前端只在注册表单发验证码,提交代码这
条路径从来不传,分支永远进不去。

验证码现在只服务注册流程。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-05 23:35:24 -06:00
3a9ab83ba5 style: ruff format 全仓库
行宽 180 下把历史遗留的折行表达式合并,无语义改动。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-05 04:45:26 -06:00
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
f77b98d4d7 fix 2026-07-03 18:34:12 -06:00
fc09d291a7 fix 2026-07-03 18:28:25 -06:00
979c709333 fix 2026-07-03 18:19:16 -06:00
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
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
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
be1610faa6 feat(submission): add FormatCodeAPI view 2026-06-14 07:51:41 -06:00
bfeb69434e feat(submission): add FormatCodeSerializer
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 07:48:58 -06:00
4cd37cef78 feat(submission): add ruff/clang-format code formatting helper 2026-06-14 07:46:41 -06:00
2b65acf91a update 2026-06-05 08:51:57 -06:00
b28301bbb1 fix 2026-06-04 05:31:23 -06:00
809673e64f fix 2026-06-03 04:50:46 -06:00
d1fdbcf52b fix 2026-06-02 23:13:06 -06:00
6ab2886f77 remove contest type 2026-05-26 23:10:27 -06:00
57c0572fd9 async 2026-05-26 21:25:26 -06:00
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
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
2cd1e2701f fix 2026-05-24 23:43:18 -06:00
c1d2e960bd add all in duration 2026-05-24 23:11:53 -06:00
65c48437a9 fix 2026-05-24 20:44:02 -06:00
a744baf4c9 fix 2026-05-17 07:31:05 -06:00
e4e8b7759d update for django6 2026-05-09 05:57:30 -06:00
c466dfd3c6 change enum 2026-05-09 02:30:47 -06:00
e2d566436f add index for models 2026-04-23 14:10:48 -06:00
028ea6e5f9 fmt 2026-04-23 13:57:56 -06:00
24ff67ec0c fix 2026-03-30 09:34:38 -06:00
ab62d7bff8 add end_time 2026-03-16 23:44:47 +08:00
3763032a9a fix 2026-03-09 21:07:54 +08:00
05d46295a0 add today 2026-03-02 19:40:33 +08:00
ea92a24f82 返回提交id 2026-01-04 10:32:02 +08:00
ab9fe71fb0 update 2025-12-29 20:19:32 +08:00
03f1bfdf86 update 2025-10-23 12:42:24 +08:00
f0dc86265b update 2025-10-23 09:36:03 +08:00
a103dd6b38 add flowchart list 2025-10-20 20:05:10 +08:00
4168d41a16 删除无用代码并且新增流程图相关内容 2025-10-11 23:29:56 +08:00
22d4a9057b add ws 2025-10-07 17:03:14 +08:00
a6d76a64c4 重构用户权限 2025-09-25 18:41:23 +08:00
8436a4602f add heatmap 2025-09-25 15:25:39 +08:00
6e1e3ef0c6 新增AI分析 2025-09-24 01:02:29 +08:00
626d86d142 filter by language 2025-09-21 19:32:50 +08:00
45d727a9e0 删掉旧的数据库迁移文件 2025-06-14 17:08:52 +08:00
450ee800f3 update 2025-04-14 12:41:00 +08:00
025276002d 在前台添加今日提交数 2025-04-14 12:36:46 +08:00
43dfeb2fa0 击败多少用户 2025-04-13 21:48:35 +08:00
8d6e9ff1f9 fix 2025-04-13 12:16:02 +08:00
6a4e8c7700 隐藏所有的提交 2025-04-13 11:49:23 +08:00