-
Notifications
You must be signed in to change notification settings - Fork 242
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
Feature: Option to retain old grading data #7256
base: master
Are you sure you want to change the base?
Feature: Option to retain old grading data #7256
Conversation
d6f138d
to
896d896
Compare
3658acb
to
76e1739
Compare
app/jobs/submissions_job.rb
Outdated
filename = annotation.submission_file.filename | ||
path = annotation.submission_file.path | ||
|
||
new_submission_file = new_submission.submission_files.where(filename: filename, path: path).first |
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 wonder whether there is a better way to do this (rather than by filename and path).
Pull Request Test Coverage Report for Build 11606631947Details
💛 - Coveralls |
ce5d579
to
aeadf2b
Compare
738cd52
to
19c19f7
Compare
<button | ||
type="submit" | ||
name="commit" | ||
onClick={event => { |
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 moved this out of the onClick
logic and into the onSubmit
logic for the form so I could test this properly, otherwise there were errors about a lack of implementation for onSubmit
1b64a1b
to
295894a
Compare
295894a
to
0af67d5
Compare
…x annotation tests
0af67d5
to
01e0d63
Compare
01e0d63
to
934613f
Compare
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.
Hi @pranavrao145, great work! I just did a quick review of the back-end implementation and left some comments. Please work on those, and then I'll do another review in a few days.
app/jobs/submissions_job.rb
Outdated
@@ -5,6 +5,101 @@ def add_warning_messages(messages) | |||
Rails.logger.error msg | |||
end | |||
|
|||
def copy_old_grading_data(new_submission, grouping) |
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.
Overall, please make this a Submission
instance method. You can just raise an exception if there's an error, and then in the perform
method here, catch the exception to display the error message in the flash. You can call it copy_grading_data
.
Make the argument to pass in old_submission
, not the grouping. Compute the old_submission
in the perform
method, and use the grouping.current_submission_used
method to grab this, rather than checking the created_at
timestamps.
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.
Hi @david-yz-liu, thanks for the feedback! Code is looking a lot cleaner now. One question, seems the flash message on error is already taken care of implicitly when the Submissions model raises an exception, and it displays a clean message in red. However, this stops progress on all submissions if any one of them has a problem.
Would you like me to explicitly rescue Submission class errors here and add it only as a warning-level alert (using add_warning_messages
), or just leave it at the error-level alert with a stop in processing other submissions? Content-wise, messages on both are pretty much the same (neither give the group info), so I thought I'd verify what the intended behaviour is.
I'm just going to convert this back to a draft while I work on addressing comments just so it doesn't run tests on intermediate work, and I'll make it ready for review again once I'm finished! EDIT: back to ready now, but Jest tests still wrongly failing |
dee204a
to
45fdec2
Compare
45fdec2
to
d21cd93
Compare
d21cd93
to
4c50f3b
Compare
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.
@pranavrao145 great work. I just left a few minor comments.
A wrinkle: after some discussion, I now understand that a common use case for this feature is that when an instructor receives a remark request, that's what triggers a new submission to be collected (i.e., the submission files need to be changed). Given this, I do think it's best to copy over both the original result and new remark result after all. Can you please modify the code to make this work (you might want to refactor again to create a Result
instance method). Sorry about this!
/> | ||
</label> | ||
| ||
{this.state.retain_existing_grading ? ( |
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.
Keep the checkbox label the same for both checked and unchecked states. Instead, if the option is unchecked, show a warning div (same styling as warning flash messages) with the extra warning message. Since the div will have good styling already, you don't need to bold the warning message.
|
||
// workaround needed for using i18n in jest tests, see | ||
// https://github.com/fnando/i18n/issues/26#issuecomment-1235751777 | ||
jest.mock("i18n-js", () => { |
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.
Ah yes, can you actually move these mocks into one of the Jest setup files (and remove them from existing places in the codebase)?
@@ -170,9 +170,16 @@ def manually_collect_and_begin_grading | |||
else | |||
params[:apply_late_penalty] | |||
end | |||
retain_existing_grading = if params[:retain_existing_grading].nil? |
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.
Similar to below, here I suspect you can do a params[:retain_existing_grading] == 'true'
. You can modify the apply_late_penalty
setting above as well.
Proposed Changes
Closes #5212.
Type of Change
(Write an
X
or a brief description next to the type or types that best describe your changes.)Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]
into a[x]
in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
After opening your pull request:
Questions and Comments
Within inline comments.