When a set def file numbers a problem as 0

未关闭
#2,255 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
perl
领域
backend

调研方向

The problem-id check that accepts a leading 0 is in DB.pm around lines 2414-2419, as the issue describes. Read that block and the error message beside it, then confirm how a set def file with problem id 0 gets through. Done means the regex rejects a leading 0 and the message names the bad id, and the maintainers have agreed whether the whole import should halt. The discussion is unresolved and the issue has been idle for about three years, so ask on the issue before writing code.

由索引模型根据 Issue 内容生成。

描述

This is discussed at https://github.com/openwebwork/webwork2/pull/2194#issuecomment-1811919002, but I'm moving it to an issue. The issue is about what can happen if a set def file uses 0 as a problem id.

Some discussion on that thread is about how to salvage the situation and what new number to use for the problem numbered 0. But I suggest that if the set def file has a bad problem id anywhere, the whole thing should halt and no problem set should be created. With an informative error message about what is wrong with the set def file.

The cases of a set definition containing any invalid problem id comes from someone editing a set definition file by hand.

Possibly from other places too though. PreTeXt automatically creates set def files for all the WW exercises from a section of a book. I don't think it can create invalid problem numbers, but my point is that some automatic creation of set def files can come from external sources. PTX is one example (possibly the only one but who knows).

My suggestion would be to just edit lines 2414-2419 of DB.pm. The regex pattern could change to disallow a leading 0. And the message could be rephrased. If there is an existing set def file out in the world that uses 0 for a problem, it will now fail to import but....good?

主要语言
Perl
星标
164
派生
167
平均合并
6 天 7 小时
30 天内合并 PR
27

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

openwebwork/webwork2 的其他 Issue

查看 openwebwork/webwork2 的全部 Issue

相似的 Issue

更多 Perl Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。