Gradebook: add attempted field to subsection data, remove 2 unused fields.
This commit is contained in:
committed by
Alex Dusenbery
parent
14009d3a6b
commit
e44c6af957
@@ -34,10 +34,9 @@ class SectionBreakdownSerializer(serializers.Serializer):
|
||||
"""
|
||||
Serializer for the `section_breakdown` portion of a gradebook entry.
|
||||
"""
|
||||
attempted = serializers.BooleanField()
|
||||
category = serializers.CharField()
|
||||
displayed_value = serializers.CharField()
|
||||
is_graded = serializers.BooleanField()
|
||||
grade_description = serializers.CharField()
|
||||
label = serializers.CharField()
|
||||
letter_grade = serializers.CharField()
|
||||
module_id = serializers.CharField()
|
||||
|
||||
@@ -425,7 +425,7 @@ class GradebookView(GradeViewMixin, PaginatedAPIView):
|
||||
subsection_grade = course_grade.subsection_grade(subsection.location)
|
||||
short_label = default_labeler(subsection_grade.format)
|
||||
|
||||
graded_description = 'Not Attempted'
|
||||
attempted = False
|
||||
score_earned = 0
|
||||
score_possible = 0
|
||||
|
||||
@@ -440,10 +440,7 @@ class GradebookView(GradeViewMixin, PaginatedAPIView):
|
||||
# attribute if the user has attempted this graded subsection, or if there
|
||||
# has been a grade override applied.
|
||||
if subsection_grade.attempted_graded or subsection_grade.override:
|
||||
graded_description = '({earned:.2f}/{possible:.2f})'.format(
|
||||
earned=subsection_grade.graded_total.earned,
|
||||
possible=subsection_grade.graded_total.possible,
|
||||
)
|
||||
attempted = True
|
||||
score_earned = subsection_grade.graded_total.earned
|
||||
score_possible = subsection_grade.graded_total.possible
|
||||
|
||||
@@ -451,10 +448,9 @@ class GradebookView(GradeViewMixin, PaginatedAPIView):
|
||||
# 'displayed_value' should maybe be 'description_percent'
|
||||
# 'grade_description' should be 'description_ratio'
|
||||
breakdown.append({
|
||||
'attempted': attempted,
|
||||
'category': subsection_grade.format,
|
||||
'displayed_value': '{:.2f}'.format(subsection_grade.percent_graded),
|
||||
'is_graded': subsection_grade.graded,
|
||||
'grade_description': graded_description,
|
||||
'label': short_label,
|
||||
'letter_grade': course_grade.letter_grade,
|
||||
'module_id': text_type(subsection_grade.location),
|
||||
|
||||
@@ -402,10 +402,9 @@ class GradebookViewTest(GradebookViewTestBase):
|
||||
"""
|
||||
return [
|
||||
OrderedDict([
|
||||
('attempted', True),
|
||||
('category', 'Homework'),
|
||||
('displayed_value', '0.50'),
|
||||
('is_graded', True),
|
||||
('grade_description', '(1.00/2.00)'),
|
||||
('label', 'HW 01'),
|
||||
('letter_grade', letter_grade),
|
||||
('module_id', text_type(self.subsections[self.chapter_1.location][0].location)),
|
||||
@@ -415,10 +414,9 @@ class GradebookViewTest(GradebookViewTestBase):
|
||||
('subsection_name', 'HW 1')
|
||||
]),
|
||||
OrderedDict([
|
||||
('attempted', True),
|
||||
('category', 'Lab'),
|
||||
('displayed_value', '0.50'),
|
||||
('is_graded', True),
|
||||
('grade_description', '(1.00/2.00)'),
|
||||
('label', 'Lab 01'),
|
||||
('letter_grade', letter_grade),
|
||||
('module_id', text_type(self.subsections[self.chapter_1.location][1].location)),
|
||||
@@ -428,10 +426,9 @@ class GradebookViewTest(GradebookViewTestBase):
|
||||
('subsection_name', 'Lab 1')
|
||||
]),
|
||||
OrderedDict([
|
||||
('attempted', True),
|
||||
('category', 'Homework'),
|
||||
('displayed_value', '0.50'),
|
||||
('is_graded', True),
|
||||
('grade_description', '(1.00/2.00)'),
|
||||
('label', 'HW 02'),
|
||||
('letter_grade', letter_grade),
|
||||
('module_id', text_type(self.subsections[self.chapter_2.location][0].location)),
|
||||
@@ -441,10 +438,9 @@ class GradebookViewTest(GradebookViewTestBase):
|
||||
('subsection_name', 'HW 2')
|
||||
]),
|
||||
OrderedDict([
|
||||
('attempted', True),
|
||||
('category', 'Lab'),
|
||||
('displayed_value', '0.50'),
|
||||
('is_graded', True),
|
||||
('grade_description', '(1.00/2.00)'),
|
||||
('label', 'Lab 02'),
|
||||
('letter_grade', letter_grade),
|
||||
('module_id', text_type(self.subsections[self.chapter_2.location][1].location)),
|
||||
|
||||
Reference in New Issue
Block a user