Skip to content

Another legacy NumberWithUnits issue. #1311

@drgrice1

Description

@drgrice1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions