Skip to content

Commit 000032a

Browse files
committed
Tidy up answer-test generated notes in matrix, and more robust check they are non-empty.
1 parent 80f2324 commit 000032a

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

stack/maxima/stackmaxima.mac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1652,7 +1652,7 @@ ATMatrix(SA, SB) := block([RawMark, FeedBack, AnswerNote, str, ret, SAr, SAc, SB
16521652
retnew:ATAlgEquivfun(SA[kloop], SB[kloop]),
16531653
ret[1]:ret[1] and retnew[1],
16541654
ret[2]:ret[2] and retnew[2],
1655-
ret[3]:concat(ret[3], " ", retnew[3]),
1655+
ret[3]:strim(" ", concat(ret[3], " ", retnew[3])),
16561656
if retnew[2] = false then AddFeedBack:true
16571657
),
16581658
if AddFeedBack = true then block(

stack/prt.evaluatable.class.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,14 @@ public function get_answernotes($atnotes = true) {
272272
}
273273
$i = 0;
274274
foreach ($path as $atresult) {
275-
if ($atnotes && ($atresult[2] !== '""')) {
276-
$notes[] = trim($atresult[2]);
275+
if ($atnotes) {
276+
// Some answer test notes are non-empty whitespace string, e.g. " ";
277+
$note = trim($atresult[2]);
278+
// Strip off "" and trim.
279+
$note = trim(substr($note, 1, strlen($note) - 2));
280+
if ($note !== '') {
281+
$notes[] = trim($atresult[2]);
282+
}
277283
}
278284
// We need to check the array_key_exists because in the case of a guard clause it will not.
279285
// Do we actually want to ignore the missing note here or indicate the note is missing with a note?

0 commit comments

Comments
 (0)