mitodl / mitx-grading-library

The MITx Grading Library, a python grading library for edX
https://edge.edx.org/courses/course-v1:MITx+grading-library+examples/
BSD 3-Clause "New" or "Revised" License
14 stars 9 forks source link

give dependent sampler access to constants #198

Closed ChristopherChudzicki closed 5 years ago

ChristopherChudzicki commented 5 years ago

addresses #197

jolyonb commented 5 years ago

Thanks for doing this. Just the one comment.

jolyonb commented 5 years ago

Hmm. Sorry, I caught one more thing. gen_symbols_samples now returns dictionaries containing all the variables AND constants, right? So in FormulaGrader's raw_check function, we don't need to initialize the variables with the constants any more; we can just set the variable list to the constants.

Also, there's a cute bug here that we need to fix: a dependent variable that has the same name as a constant can lead to problems. We need to scrub the list of constants of any variable names before we do the sampling.

jolyonb commented 5 years ago

:+1:

ChristopherChudzicki commented 5 years ago

I think this is all set now! Good catches...

Also, there's a cute bug here that we need to fix: a dependent variable that has the same name as a constant can lead to problems. We need to scrub the list of constants of any variable names before we do the sampling.

Took me a little while to write an example.

jolyonb commented 5 years ago

It's a cute little gotcha, isn't it? You'd have to be doing something fairly contrived to trigger it, but still!