maths / moodle-qtype_stack

Stack question type for Moodle
GNU General Public License v3.0
142 stars 149 forks source link

Simplification issue with bespoke validators #1318

Open bgailer opened 5 days ago

bgailer commented 5 days ago

Hello,

I have used the bespoke validators quite a lot recently, and I want to say that they are a really nice feature. One thing I noticed though is that when simplification is turned on, or I have simp: true; at the end of the question variables, the student answer that my bespoke validator receives as argument is already simplified. The validation block shows the unsimplified answer, but the bespoke validator receives the simplified answer.

For instance, sin(%pi) gets validated in the block as sin(%pi) but inside the bespoke validator it is 0. I would normally expect the unsimplified version of the student's answer as bespoke validator argument, unless I use the extra option simp for the input. Is this by design or due to the way bespoke validators are executed?

sangwinc commented 5 days ago

Yes, I've had a very quick preliminary look.

  1. If you put simp:true in the question variables then I can reproduce the problem.
  2. If you don't put simp:true in the question variables then I can't reproduce the problem.

I can't immediately figure out why this is the case, but simp is not defined as a context variable.