Skip to content

feat: 完善问卷规则、资料导入导出与新版答卷管理 - #49

Merged
Renko6626 merged 9 commits into
mainfrom
feat/questionnaire-admin-pr
Nov 9, 2026
Merged

Renko6626 merged 9 commits into
mainfrom
feat/questionnaire-admin-pr

Conversation

@Renko6626

@Renko6626 Renko6626 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

统一问卷的后端定义、语义编码、答案校验和完成判断,角色/音乐/CP 投票要求先保存满足“所有必填+至少一份额外问卷”的 V2 答案。管理台补齐候选导入和新版答卷管理,可查看历史提交并整批作废、恢复;最新作废不回退旧批次,原始答案仍可回填修改。

同时补齐作品/角色/音乐资料 JSON 下载、图片/试听 URL 导入,以及作品 JSON/CSV 批量导入。候选只关联已有投票对象,导入校验有错误时整批不写入。包含已授权测试数据清理的操作记录;PR 本身不携带清库任务。

本分支基于最新 main 整理,未重复带入已合并的拼音搜索历史,也未包含独立 PR #36 的音乐快照修复。

验证:

  • 最终 PR 分支在临时 PostgreSQL 16 迁移到 0023 后执行 python -m pytest tests/ -q:947 passed(116.51秒,包含数据库约束检查,无跳过)。
  • python -m flake8 src/ --max-line-length=88、pnpm --dir admin-ui build、git diff --check 均通过;构建产物与提交一致,工作区干净。
  • 0023 在临时 PostgreSQL 16 升级、降级、再升级通过,原答案保留且新增标记默认 false。
  • GitHub CI #42679997927 已全部通过,包括 PostgreSQL 15 迁移及测试;PR事件的镜像构建与部署均跳过。
  • 独立只读复核未发现阻止合入的核心兼容问题。
  • 浏览器交互和云端部署后验收未执行。

迁移与发布:

  • 新增 Alembic 0023(父0022),仅增加 paper_answer.invalidated BOOLEAN NOT NULL DEFAULT false,不清表、不改现有答案或账号。
  • 必须先迁移再运行本版代码;合入 main 会触发现有测试环境自动部署及 alembic upgrade head,实际合并/迁移在明确确认后执行,尚未操作云端。
  • 回退应用时可保留新列;若降级到0022会丢失作废标记,原始答案仍在。旧代码不执行新版作废口径。
  • 真实题库仍需按已确认的必填/额外分类配置;已有结果与高级筛选缓存通过手动重新计票刷新。raw_paper 其他旧 API、导出、同步及物理删表后续单独退出。

接口及回退说明:docs/api/questionnaire-submissions.md;完整实施和验证记录:docs/superpowers/plans/2026-11-10-candidate-import-and-answer-admin.md。

Require all mandatory questionnaires and at least one optional extra. Remove legacy paper and empty-definition completion bypasses, return REST completion errors, and document the policy and gate.

Validation: scoped backend pytest 85 passed; affected submit API suite 26 passed after added GraphQL coverage; production flake8 and staged diff checks passed. No schema migration or deployment.
Add a standalone command to inspect all definition tables, report structural and reference errors, and return release-check exit codes. Keep missing codes as warnings and sanitize configuration failure output.

Validation: related questionnaire suite 58 passed; affected checker file 31 passed after the review fix; flake8, CLI help, document links and staged diff checks passed. Real database not checked; no schema or deployment changes.
Align four completed questionnaire stages with their implementation commits, consolidate remaining work and verification boundaries, and repair API navigation links. Preserve original requirement and historical execution records.

Documentation only. Verified 233 local links and 20 Markdown anchors during the closeout review; staged diff check passed. No application tests rerun, database access, push or deployment.
@Renko6626
Renko6626 merged commit 17f3513 into main Nov 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant