Skip to content

[Bug] 已结束比赛的直接题目提交回退功能失效 #1017

Description

@boomzero

检查项

  • 我已确认该问题在当前版本中仍然存在。
  • 我已搜索现有 Issues,未发现相同的开放问题。

问题描述

#287 / #671 实现的“比赛结束后自动向原题提交”功能现在已失效。

这里的问题不是普通提交按钮,也不是 QuickSubmit CLI 本身,而是 XMOJ.user.js 提交页代码中借用 QuickSubmit 逻辑实现的回退路径:

  1. 在比赛提交页先以 cid + pid 向 submit.php 提交;
  2. 如果返回内容包含 没有这个比赛!,则请求对应的 contest.php?cid=...;
  3. 从 #problemset > tbody 中取得该比赛题目对应的真实 PID;
  4. 再以 id=<真实 PID> 直接提交。

当前从已结束比赛的提交页提交时,这条回退路径不再成功,最终仍然显示提交失败,且没有向原题创建提交记录。

复现步骤

  1. 打开一个已经结束的比赛中的题目提交页:/submitpage.php?cid=<cid>&pid=<pid>。
  2. 输入任意非空代码并点击“提交”。
  3. 观察提交结果。

期望行为

比赛提交已经不可用时,脚本应当像 #287 设计的那样解析真实题号,并自动改为向原题直接提交。

实际行为

脚本未能完成向原题的回退提交,页面显示“提交失败!请关闭脚本后重试!”,且没有新的提交记录。

相关代码

当前逻辑位于 XMOJ.user.js 的提交页 PassCheck 处理器中(约 4200–4291 行),QuickSubmit 来源说明在约 4219 行。

建议检查:

  • XMOJ 当前失败响应是否仍然包含精确字符串 没有这个比赛!;
  • 失败响应现在是否通过重定向返回,导致回退分支根本不会执行;
  • #problemset > tbody 的当前结构是否仍与 rows[i].children[1].textContent.substring(2, 6) 的解析假设一致;
  • 直接重试成功后,外层处理是否仍会继续执行并覆盖为“提交失败”状态。

Activity

  1. INFP-coder commented on Aug 22, 2026

    @INFP-coder

    你们说仅检查 text.indexOf("没有这个比赛!")行不行
    主要是要保证服务端不会返回其他错误提示(如“比赛已结束”)或响应为重定向导致无法捕获文本

  2. INFP-coder commented on Aug 22, 2026

    @INFP-coder

    而且发起二次提交后只 console.log 了响应文本,未根据结果决定是否继续,也未阻止外层错误显示。

  3. INFP-coder commented on Aug 22, 2026

    @INFP-coder

    检查单

    • 是否可以提取真实题目号?
    • 新增回退提交后判断结果并阻断外层错误
    • 检查是否需要更宽泛的错误检测
  4. INFP-coder commented on Aug 22, 2026

    @INFP-coder

    我去看看
    还有本人喜欢在每个issue下面弄个检查单 /bx

  5. INFP-coder commented on Aug 22, 2026

    @INFP-coder

    怎么找一个满足这个条件的比赛.jpg

  6. INFP-coder commented on Aug 23, 2026

    @INFP-coder

    ok
    重现成功在任何月赛 开始尝试我自己的修改

  7. INFP-coder commented on Aug 23, 2026

    @INFP-coder
    Image

    fixed!!

  8. INFP-coder commented on Aug 23, 2026

    @INFP-coder

    new bug is detected: 状态里没有题目提交记录

  9. boomzero commented on Aug 23, 2026

    @boomzero
    MemberAuthor

    It is a rate limit issue

  10. added theissue type on Aug 23, 2026
  11. moved this from Done to In Progress in xmoj-scripton Sep 18, 2026
  12. moved this from In Progress to Done in xmoj-scripton Sep 19, 2026
  13. added a commit that references this issue on Oct 6, 2026
    586d916
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleHurry up!

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions