Skip to content

Commit

Permalink
Merge pull request #20 from edx/matthugs/correct-graded-all-discrepancy
Browse files Browse the repository at this point in the history
Correct data source for gradebook grades
  • Loading branch information
Matt Hughes authored Aug 15, 2019
2 parents 5dbe459 + cce1e32 commit 65bac3e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Unreleased

*

[0.5.2] - 2019-08-15
~~~~~~~~~~~~~~~~~~~~
* Bring datasource for grade information inline with what the rest of gradebook uses

[0.4.4] - 2019-08-13
~~~~~~~~~~~~~~~~~~~~
Add ability to filter by course grade, provided as a percentage to the endpoint.
Expand Down
2 changes: 1 addition & 1 deletion bulk_grades/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

from __future__ import absolute_import, unicode_literals

__version__ = '0.5.1'
__version__ = '0.5.2'

default_app_config = 'bulk_grades.apps.BulkGradesConfig' # pylint: disable=invalid-name
14 changes: 7 additions & 7 deletions bulk_grades/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def process_row(self, row):
row['course_id'],
row['block_id'],
overrider=self._user,
earned_all=row['new_grade'],
earned_graded=row['new_grade'],
feature='grade-import'
)
return True, None
Expand Down Expand Up @@ -324,10 +324,10 @@ def get_rows_to_export(self):
if not subsection_grade:
continue
try:
effective_grade = (subsection_grade.override.earned_all_override
/ subsection_grade.override.possible_all_override) * 100
effective_grade = (subsection_grade.override.earned_graded_override
/ subsection_grade.override.possible_graded_override) * 100
except AttributeError:
effective_grade = (subsection_grade.earned_all / subsection_grade.possible_all) * 100
effective_grade = (subsection_grade.earned_graded / subsection_grade.possible_graded) * 100
if (self.subsection_grade_min and effective_grade < self.subsection_grade_min) or (
self.subsection_grade_max and effective_grade > self.subsection_grade_max):
continue
Expand All @@ -343,9 +343,9 @@ def get_rows_to_export(self):
row['name-{}'.format(block_id)] = display_name
grade = grades.get(subsection.location, None)
if grade:
row['grade-{}'.format(block_id)] = grade.earned_all
row['grade-{}'.format(block_id)] = grade.earned_graded
try:
row['previous-{}'.format(block_id)] = grade.override.earned_all_override
row['previous-{}'.format(block_id)] = grade.override.earned_graded_override
except AttributeError:
row['previous-{}'.format(block_id)] = None
yield row
Expand Down Expand Up @@ -428,7 +428,7 @@ def get_rows_to_export(self):
row['name-{}'.format(block_id)] = display_name
grade = grades.get(subsection.location, None)
if grade:
row['grade-{}'.format(block_id)] = grade.earned_all
row['grade-{}'.format(block_id)] = grade.earned_graded
yield row


Expand Down
4 changes: 2 additions & 2 deletions mock_apps/lms/djangoapps/grades/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def __init__(self, block_id, display_name):

class Grade(object):
def __init__(self):
self.earned_all = 1
self.earned_graded = 1
self.override = None
self.possible_all = 1
self.possible_graded = 1


def prefetch_course_and_subsection_grades(course_id, users):
Expand Down

0 comments on commit 65bac3e

Please sign in to comment.