Custom marking algorithm question

17 views
Skip to first unread message

Jim Pettigrew

unread,
Feb 15, 2021, 8:07:57 PM2/15/21
to numbas...@googlegroups.com
Hi Christian (and all),

I'm getting some grief adapting a customised gap-fill question.

The line

this.__proto__.mark.apply(this);

in the custom marking algorithm for the question

https://numbas.mathcentre.ac.uk/question/89869/only-mark-a-gap-depending-on-the-answer-to-a-previous-gap

(and other similar questions) causes an error.

Are you able to explain why?

Thanks,

Jim

Christian Lawson-Perfect

unread,
Feb 16, 2021, 9:07:28 AM2/16/21
to numbas...@googlegroups.com
Hi Jim,
The internals of the marking functions changed in Numbas v5 to accommodate alternative answers. The "mark student's answer" JavaScript now replaces Part.mark_answer, instead of Part.mark. Part.mark_answer takes two arguments, studentAnswer and scope, so you need to pass those when you call the built-in version. So the line should read:

  this.__proto__.mark_answer.apply(this,[studentAnswer,scope]);

But you don't need JavaScript to do the marking you want. It could be achieved using a JME marking algorithm, and those are a lot more stable than the JavaScript API.

In fact, the question you've set up would be even easier to implement in explore mode: you could decide whether to show the "enter the factorisation" part based on the student's answer to "does this equation have a factorisation?"

I hope that helps.

--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/numbas-users/CAJ9nevEp4L1YuFULJniRYoqKLh7hBgmJvCXpTdqdXMQ2jkKQWg%40mail.gmail.com.

Jim Pettigrew

unread,
Feb 16, 2021, 10:00:36 PM2/16/21
to numbas...@googlegroups.com
Thanks very much Christian.

It does help.

I suspected the code I was using (borrowed from elsewhere) was deprecated in some way.

Based on your advice, I've rejigged the question without using this.__proto__.mark_answer.apply(this,[studentAnswer,scope]);

When I get a moment, I will try redoing the question in explore mode. This does seem to be the better - perhaps more generalisable - way of doing things.

Cheers,

Jim

Reply all
Reply to author
Forward
0 new messages