Skip to content

force subsection grades to update when course grade updates - #15627

Merged
sanfordstudent merged 1 commit into
masterfrom
sstudent/compute_grades_fix
Jul 21, 2017
Merged

force subsection grades to update when course grade updates#15627
sanfordstudent merged 1 commit into
masterfrom
sstudent/compute_grades_fix

Conversation

@sanfordstudent

@sanfordstudent sanfordstudent commented Jul 20, 2017

Copy link
Copy Markdown
Contributor

EDUCATOR-915

Forces subsection grades to update when iterating over course grades and forcing them to update.

Reviewers:

FYI: @edx/educator-neem

@sanfordstudent

Copy link
Copy Markdown
Contributor Author

jenkins run python

@sanfordstudent
sanfordstudent force-pushed the sstudent/compute_grades_fix branch from 2cada4f to f4e8f21 Compare July 20, 2017 21:00
@sanfordstudent

Copy link
Copy Markdown
Contributor Author

jenkins run python

@iloveagent57 iloveagent57 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I could go either way on the comment I left.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: if you wanted to cut down on the lines of code, you could have a kwargs dict that holds all of the common kwargs, add the conditional method = ... line back, then do:

if force_update:
    kwargs['force_update_subsections'] = True
course_grade = method(**kwargs)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that much better.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: why does this need to be passed in? Won't we always want this to be true in this update method, per caller's expectations?

@sanfordstudent sanfordstudent Jul 21, 2017

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to pass it in because we also call CourseGradeFactory().update when a subsection grade is updated. If we assume true for all cases, then all subsection grades will update whenever a learner submits a problem.

https://github.com/edx/edx-platform/blob/master/lms/djangoapps/grades/signals/handlers.py#L246

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha! +1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you should be able to undo these changes, if we agree that this boolean doesn't need to default to false.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can revert these changes per my comment above regarding not needing to pass force_update_subsections to the CourseGradeFactory's update method - since it's assumed from the method's contract.

Comment thread lms/djangoapps/grades/tests/test_new.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you planning to add any non-mock tests - to verify that any previously stored Subsection-grades do get updated? And, to capture what happens to old zero grades?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to write a more robust test but refrained for now since this change is somewhat time-sensitive. I can add that in this PR if we're not comfortable merging without it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good

@sanfordstudent
sanfordstudent force-pushed the sstudent/compute_grades_fix branch from 7f6531f to 66fdd2f Compare July 21, 2017 17:04
@sanfordstudent
sanfordstudent merged commit 7d9cc90 into master Jul 21, 2017
@sanfordstudent
sanfordstudent deleted the sstudent/compute_grades_fix branch July 21, 2017 18:03
@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production on Monday, July 24, 2017.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

EdX Release Notice: This PR has been rolled back from the production environment.

@nedbat

nedbat commented Aug 1, 2017

Copy link
Copy Markdown
Contributor

I've cherry-picked this onto Ginkgo (along with #15701)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants