-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: add grading method support #299
Conversation
c79d133
to
ef8b811
Compare
2b0860e
to
652f132
Compare
xmodule/capa_block.py
Outdated
|
||
new_score = self.score_from_lcp(self.lcp) | ||
self.score_history.append(new_score) | ||
grading_strategy_handler = GradingStrategyHandler( | ||
self.grading_strategy, | ||
self.score_history, | ||
self.max_score(), | ||
) | ||
score = grading_strategy_handler.get_score() | ||
self.set_score(score) |
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.
Can we move this to its method? called _set_score
or something like it, so we can encapsulate the functionality
xmodule/capa_block.py
Outdated
grading_strategy_handler = GradingStrategyHandler( | ||
self.grading_strategy, | ||
self.score_history, | ||
self.max_score(), | ||
) | ||
calculated_score = grading_strategy_handler.get_score() |
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.
Should we move this piece of code to its own method? so we can re-use it elsewhere
6ac85ba
to
fa59c65
Compare
xmodule/capa/capa_problem.py
Outdated
if 'filesubmission' in responder.allowed_inputfields and student_answers is not None: | ||
results = responder.evaluate_answers(student_answers, oldcmap) | ||
else: | ||
results = responder.evaluate_answers(student_answers, oldcmap) |
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.
what's the difference between these two conditions?
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.
No difference, conditional would not be necessary
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.
can we update it then? thanks!
|
||
# enforce_type is set to False here because this field is saved as a dict in the database. | ||
score = ScoreField(help=_("Dictionary with the current student score"), scope=Scope.user_state, enforce_type=False) | ||
score_history = ListScoreField( |
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.
why do we need a new field for this?
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.
Because if it is stored as a List
field, when querying the value it will have a dictionary, and it should have an instance of Score
xmodule/capa_block.py
Outdated
@@ -2206,13 +2266,35 @@ def update_correctness(self): | |||
new_correct_map = self.lcp.get_grade_from_current_answers(None) | |||
self.lcp.correct_map.update(new_correct_map) | |||
|
|||
def update_correctness_list(self): | |||
"""Updates the correctness map list of the LCP.""" |
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.
can you explain in detail what does this do?
if new_correct_map_list: | ||
self.lcp.correct_map.update(new_correct_map_list[-1]) |
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.
I don't get this part in particular
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.
After updating each correct map in correct_map_history
, take the last correct map in the history and assign it to the correct_map
field, to update the field with the current correct map.
xmodule/capa_block.py
Outdated
self.correct_map_history.append(correct_map.get_dict()) | ||
|
||
new_score = self.score_from_lcp(self.lcp) | ||
self.score_history.append(new_score) | ||
grading_strategy_handler = GradingStrategyHandler( | ||
self.score, | ||
self.grading_strategy, | ||
self.score_history, | ||
self.max_score(), | ||
) | ||
score = grading_strategy_handler.get_score() | ||
self.set_score(score) |
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.
I'm still missing here moving this into its own method.
5d5adf7
to
7b580ff
Compare
ec0aaeb
to
dfe9032
Compare
cf084d3
to
d3416c9
Compare
3afaeae
to
ae8a024
Compare
ae8a024
to
7f54dd2
Compare
7f54dd2
to
33bb89d
Compare
refactor: add grading strategy handler class feat: show grading strategy in student view fix: reset score history when reset student attempts fix: add missing argument in handle_average_attempt and fix typing hint chore: remove inline comments and print statements docs: add class and method docstring feat: add ListScoreField refactor: update grading strategy handler feat: consider grading strategy in rescore functionality feat: reset score history when reset student attempts feat: add correct_map_history and student_answers_history for rescore functionality fix: reset correct_map_history and student_answers_history when reset attempts test: fix unit tests refactor: address PR review fix: update correct_map_history from lcp instance for each attempt refactor: add _set_score and get_rescore methods chore: rename grading strategies (attempt -> score) refactor: address PR review fix: show grading strategy with unlimited attempts chore: add es_419 translations
dad9812
to
2b2f1b5
Compare
Description
This PR adds a new field in the Problem settings for choosing a Grading Method. Currently, the only Grading Method is the Last Score. From now on, the new grading methods allow are:
Dependencies
This PR works with the legacy Problem Editor interface, but if you use the new interface with course-authoring MFE, you need the changes in this PR.
Legacy Interface
MFE Interface
Testing Instructions
Grading Method
. This field is a dropdown list with the Grading Methods mentioned above.Rescoring
Advanced
>Blank Problem
. In the settings you can add this example of a problem:STAFF DEBUG INFO
>Rescore Learner's Submission