numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
199 stars 118 forks source link

Throw an error if a marking parameter has the same name as a variable already defined in the scope #892

Closed christianp closed 1 year ago

christianp commented 2 years ago

We had a question with a variable called marks, holding the marking matrix for an MCQ part. The marking parameters for a part include a variable marks, holding the number of marks available for the part.

This should have thrown an error. I think catching this at the point that the marking parameters are added to the scope is the right thing to do.

LexxLuey commented 2 years ago

Good day. I am new to open source contribution. Can I work on this?

christianp commented 2 years ago

Hi @LexxLuey, thanks for offering to help. Yes, feel free to work on any open issue tagged "good first issue".

Please have a look at our page on contributing to Numbas.

To implement this, I think that it would make sense to a check to the mark_answers function in runtime/scripts/part.js, comparing the variables defined in the scope with the entries in the marking parameters object.