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

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

Closed duongnghiephuy closed 1 year ago

duongnghiephuy commented 1 year ago

I followed the recommended solution. Added a check in mark_answers function in part runtime/scripts/part.js : if an entry in the marking parameters object is defined in the scope, throw an error.

christianp commented 1 year ago

Thank you very much for this! I made a couple of coding style changes, but you'd done most of the work. I changed the check for whether a variable is defined to use scope.getVariable.

Please can you add your name to CONTRIBUTORS.md in a new PR, or tell me how you'd like to be attributed?