-
Notifications
You must be signed in to change notification settings - Fork 4.2k
fix: deprecate ENABLE_GRADING_METHOD_IN_PROBLEMS #37811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix: deprecate ENABLE_GRADING_METHOD_IN_PROBLEMS #37811
Conversation
|
Sandbox deployment successful 🚀 |
f32df84 to
0d92c08
Compare
|
Sandbox deployment successful 🚀 |
|
Sandbox deployment successful 🚀 |
|
Sandbox deployment successful 🚀 |
| the student answers. The student answers will always remain the same over time. | ||
| """ | ||
| oldcmap = correct_map if self.is_grading_method_enabled else self.correct_map | ||
| oldcmap = correct_map if correct_map is not None else self.correct_map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a logic change from what was there previously. I would have expected this line to be updated to just be, oldcmap = correct_map, why still have this conditional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had to fall back to self.correct_map because correct_map can be None on the first grading pass, and hint logic assumes oldcmap is always a valid/non-null CorrectMap.
def get_hints(self, student_answers, new_cmap, old_cmap): # pylint: disable=too-many-locals
"""
Generate adaptive hints for this problem based on student answers, the old CorrectMap,
and the new CorrectMap produced by get_score.
Does not return anything.
Modifies new_cmap, by adding hints to answer_id entries as appropriate.
"""
hintfn = None
hint_function_provided = False
hintgroup = self.xml.find("hintgroup")
if hintgroup is not None:
hintfn = hintgroup.get("hintfn")
if hintfn is not None:
hint_function_provided = True
if hint_function_provided:
# if a hint function has been supplied, it will take precedence
# Hint is determined by a function defined in the <script> context; evaluate
# that function to obtain list of hint, hintmode for each answer_id.
# The function should take arguments (answer_ids, student_answers, new_cmap, old_cmap)
# and it should modify new_cmap as appropriate.
# We may extend this in the future to add another argument which provides a
# callback procedure to a social hint generation system.
global CORRECTMAP_PY # pylint: disable=global-statement
if CORRECTMAP_PY is None:
# We need the CorrectMap code for hint functions. No, this is not great.
CORRECTMAP_PY = inspect.getsource(correctmap)
code = (
CORRECTMAP_PY
+ "\n"
+ self.context["script_code"]
+ "\n"
+ textwrap.dedent(
"""
new_cmap = CorrectMap()
new_cmap.set_dict(new_cmap_dict)
old_cmap = CorrectMap()
old_cmap.set_dict(old_cmap_dict)
{hintfn}(answer_ids, student_answers, new_cmap, old_cmap)
new_cmap_dict.update(new_cmap.get_dict())
old_cmap_dict.update(old_cmap.get_dict())
"""
).format(hintfn=hintfn)
)
globals_dict = {
"answer_ids": self.answer_ids,
"student_answers": student_answers,
"new_cmap_dict": new_cmap.get_dict(),
> "old_cmap_dict": old_cmap.get_dict(),
}
E AttributeError: 'NoneType' object has no attribute 'get_dict'
xmodule/capa/responsetypes.py:475: AttributeError
Pending Work: