Another legacy NumberWithUnits issue.

オープン
#1,311 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 4 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
perl
領域
backend

調査の方向性

The bug is that calling Real($student) on a NumberWithUnits answer inside a custom cmp checker still returns a NumberWithUnits instead of a Real. Start by reproducing it with the checker in Library/Michigan/Chap2Sec1/Q17.pg, then find where Real() and the NumberWithUnits class are defined in the Perl sources. Done means the checker's range test works on the student's numeric value, and you know whether Real() should change or the problem should use ->value, which the reporter used as a workaround.

索引モデルが issue の本文から書いたものです。

説明

This was observed for the problem Library/Michigan/Chap2Sec1/Q17.pg. That problem uses a custom checker for the second answer in the problem. The checker tries to convert the student unit answer to a MathObject Real by calling Real($student). I think that used to result in a MathObject Real at least, but now it is still a NumberWithUnits. The checker in the problem is:

ANS(
    NumberWithUnits($v, "ft/s")->cmp(
        checker => sub {
            my ($correct, $student, $ansHash) = @_;
            $stu_real = Real($student);
            if ($min <= $stu_real && $stu_real <= $max) {
                return 1;
            } else {
                return 0;
            }
        }
    )
);

In any case, the correct answer is not accepted anymore. It worked for previous versions of PG. I have changed the call to $stu_readl = $student->value on my server which works, but this is a problem that most likely is used elsewhere.

主要言語
Perl
スター
48
フォーク
78
平均マージ
5日 13時間
マージ済み PR(30日)
9

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

openwebwork/pg のほかの issue

openwebwork/pg の issue をすべて見る

似ている issue

Perl の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。