Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning with formula matrix when some entries are blank. #1134

Open
somiaj opened this issue Oct 15, 2024 · 2 comments
Open

Warning with formula matrix when some entries are blank. #1134

somiaj opened this issue Oct 15, 2024 · 2 comments

Comments

@somiaj
Copy link
Contributor

somiaj commented Oct 15, 2024

Here is a test problem.

DOCUMENT();
loadMacros(qw(PGstandard.pl PGML.pl));

Context('Matrix');
$M = Matrix([[Formula('x')], [Formula('y')]]);

BEGIN_PGML
[``[$M]=``] [_]*{$M}
END_PGML
ENDDOCUMENT();

If you enter in 'x' for the top row and keep the bottom row blank in the problem editor, and click on check answer or show correct answer twice in a row, a warning will appear.

Can't call method "type" on unblessed reference at [PG]/lib/Value/AnswerChecker.pm line 1882 

Unsure why two submits are needed and the warning won't appear after the first. Also if you make both answer boxes blank, you need to click two submits before the warning goes away.

@dpvc
Copy link
Member

dpvc commented Oct 16, 2024

One thing to note is that $M is not a matrix of formulas, it is a matrix-valued formula internally, so I suspect that the error is coming from the post-filter that tries to check if the previous formula is equivalent to the current one. That is why it took two tries. Because one of the answers is blank, the previous formula has some non-MathObject entries, and probably can't be compared to another formula, leading to the error. I will have to look into it, but that is my initial thought.

@dpvc
Copy link
Member

dpvc commented Oct 16, 2024

As an aside, $M could be more easily created via

$m = Matrix([['x'], ['y']]);

as the strings will be parsed as formulas automatically.

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

No branches or pull requests

2 participants