Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
61c0a01b
Commit
61c0a01b
authored
Apr 12, 2017
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename location_to_scores -> problem_scores
parent
70e13407
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
29 additions
and
23 deletions
+29
-23
lms/djangoapps/courseware/tests/test_submitting_problems.py
+2
-2
lms/djangoapps/gating/tests/test_integration.py
+1
-1
lms/djangoapps/grades/new/course_grade.py
+6
-6
lms/djangoapps/grades/new/subsection_grade.py
+15
-9
lms/djangoapps/grades/tests/test_grades.py
+1
-1
lms/djangoapps/grades/tests/test_new.py
+1
-1
lms/djangoapps/instructor_task/tasks_helper.py
+1
-1
lms/templates/courseware/progress.html
+2
-2
No files found.
lms/djangoapps/courseware/tests/test_submitting_problems.py
View file @
61c0a01b
...
@@ -313,7 +313,7 @@ class TestSubmittingProblems(ModuleStoreTestCase, LoginEnrollmentTestCase, Probl
...
@@ -313,7 +313,7 @@ class TestSubmittingProblems(ModuleStoreTestCase, LoginEnrollmentTestCase, Probl
Returns list of scores for the given homework:
Returns list of scores for the given homework:
[<points on problem_1>, <points on problem_2>, ..., <points on problem_n>]
[<points on problem_1>, <points on problem_2>, ..., <points on problem_n>]
"""
"""
return
[
s
.
earned
for
s
in
self
.
hw_grade
(
hw_url_name
)
.
scores
]
return
[
s
.
earned
for
s
in
self
.
hw_grade
(
hw_url_name
)
.
problem_scores
.
values
()
]
class
TestCourseGrades
(
TestSubmittingProblems
):
class
TestCourseGrades
(
TestSubmittingProblems
):
...
@@ -337,7 +337,7 @@ class TestCourseGrades(TestSubmittingProblems):
...
@@ -337,7 +337,7 @@ class TestCourseGrades(TestSubmittingProblems):
Verifies the problem score and the homework grade are as expected.
Verifies the problem score and the homework grade are as expected.
"""
"""
hw_grade
=
self
.
hw_grade
(
'homework'
)
hw_grade
=
self
.
hw_grade
(
'homework'
)
problem_score
=
hw_grade
.
scores
[
0
]
problem_score
=
hw_grade
.
problem_scores
.
values
()
[
0
]
self
.
assertEquals
((
problem_score
.
earned
,
problem_score
.
possible
),
expected_problem_score
)
self
.
assertEquals
((
problem_score
.
earned
,
problem_score
.
possible
),
expected_problem_score
)
self
.
assertEquals
((
hw_grade
.
graded_total
.
earned
,
hw_grade
.
graded_total
.
possible
),
expected_hw_grade
)
self
.
assertEquals
((
hw_grade
.
graded_total
.
earned
,
hw_grade
.
graded_total
.
possible
),
expected_hw_grade
)
...
...
lms/djangoapps/gating/tests/test_integration.py
View file @
61c0a01b
...
@@ -151,7 +151,7 @@ class TestGatedContent(MilestonesTestCaseMixin, SharedModuleStoreTestCase):
...
@@ -151,7 +151,7 @@ class TestGatedContent(MilestonesTestCaseMixin, SharedModuleStoreTestCase):
"""
"""
course_grade
=
CourseGradeFactory
()
.
create
(
user
,
self
.
course
)
course_grade
=
CourseGradeFactory
()
.
create
(
user
,
self
.
course
)
for
prob
in
[
self
.
gating_prob1
,
self
.
gated_prob2
,
self
.
prob3
]:
for
prob
in
[
self
.
gating_prob1
,
self
.
gated_prob2
,
self
.
prob3
]:
self
.
assertIn
(
prob
.
location
,
course_grade
.
locations_to
_scores
)
self
.
assertIn
(
prob
.
location
,
course_grade
.
problem
_scores
)
self
.
assertEquals
(
course_grade
.
percent
,
expected_percent
)
self
.
assertEquals
(
course_grade
.
percent
,
expected_percent
)
...
...
lms/djangoapps/grades/new/course_grade.py
View file @
61c0a01b
...
@@ -80,15 +80,15 @@ class CourseGradeBase(object):
...
@@ -80,15 +80,15 @@ class CourseGradeBase(object):
return
subsection_grades
return
subsection_grades
@lazy
@lazy
def
locations_to
_scores
(
self
):
def
problem
_scores
(
self
):
"""
"""
Returns a dict of problem scores keyed by their locations.
Returns a dict of problem scores keyed by their locations.
"""
"""
locations_to
_scores
=
{}
problem
_scores
=
{}
for
chapter
in
self
.
chapter_grades
.
itervalues
():
for
chapter
in
self
.
chapter_grades
.
itervalues
():
for
subsection_grade
in
chapter
[
'sections'
]:
for
subsection_grade
in
chapter
[
'sections'
]:
locations_to_scores
.
update
(
subsection_grade
.
locations_to
_scores
)
problem_scores
.
update
(
subsection_grade
.
problem
_scores
)
return
locations_to
_scores
return
problem
_scores
def
score_for_chapter
(
self
,
chapter_key
):
def
score_for_chapter
(
self
,
chapter_key
):
"""
"""
...
@@ -112,8 +112,8 @@ class CourseGradeBase(object):
...
@@ -112,8 +112,8 @@ class CourseGradeBase(object):
composite module (a vertical or section ) the scores will be the sums of
composite module (a vertical or section ) the scores will be the sums of
all scored problems that are children of the chosen location.
all scored problems that are children of the chosen location.
"""
"""
if
location
in
self
.
locations_to
_scores
:
if
location
in
self
.
problem
_scores
:
score
=
self
.
locations_to
_scores
[
location
]
score
=
self
.
problem
_scores
[
location
]
return
score
.
earned
,
score
.
possible
return
score
.
earned
,
score
.
possible
children
=
self
.
course_data
.
structure
.
get_children
(
location
)
children
=
self
.
course_data
.
structure
.
get_children
(
location
)
earned
,
possible
=
0.0
,
0.0
earned
,
possible
=
0.0
,
0.0
...
...
lms/djangoapps/grades/new/subsection_grade.py
View file @
61c0a01b
...
@@ -35,11 +35,17 @@ class SubsectionGradeBase(object):
...
@@ -35,11 +35,17 @@ class SubsectionGradeBase(object):
self
.
all_total
=
None
# aggregated grade for all problems, regardless of whether they are graded
self
.
all_total
=
None
# aggregated grade for all problems, regardless of whether they are graded
@property
@property
def
scores
(
self
):
def
attempted
(
self
):
"""
"""
List of all problem scores in the subsection.
Returns whether any problem in this subsection
was attempted by the student.
"""
"""
return
self
.
locations_to_scores
.
values
()
assert
self
.
all_total
is
not
None
,
(
"SubsectionGrade not fully populated yet. Call init_from_structure or init_from_model "
"before use."
)
return
self
.
all_total
.
attempted
class
ZeroSubsectionGrade
(
SubsectionGradeBase
):
class
ZeroSubsectionGrade
(
SubsectionGradeBase
):
...
@@ -54,9 +60,9 @@ class ZeroSubsectionGrade(SubsectionGradeBase):
...
@@ -54,9 +60,9 @@ class ZeroSubsectionGrade(SubsectionGradeBase):
self
.
course_data
=
course_data
self
.
course_data
=
course_data
@lazy
@lazy
def
locations_to
_scores
(
self
):
def
problem
_scores
(
self
):
"""
"""
Overrides the
locations_to
_scores member variable in order
Overrides the
problem
_scores member variable in order
to return empty scores for all scorable problems in the
to return empty scores for all scorable problems in the
course.
course.
"""
"""
...
@@ -79,7 +85,7 @@ class SubsectionGrade(SubsectionGradeBase):
...
@@ -79,7 +85,7 @@ class SubsectionGrade(SubsectionGradeBase):
"""
"""
def
__init__
(
self
,
subsection
):
def
__init__
(
self
,
subsection
):
super
(
SubsectionGrade
,
self
)
.
__init__
(
subsection
)
super
(
SubsectionGrade
,
self
)
.
__init__
(
subsection
)
self
.
locations_to
_scores
=
OrderedDict
()
# dict of problem locations to ProblemScore
self
.
problem
_scores
=
OrderedDict
()
# dict of problem locations to ProblemScore
def
init_from_structure
(
self
,
student
,
course_structure
,
submissions_scores
,
csm_scores
):
def
init_from_structure
(
self
,
student
,
course_structure
,
submissions_scores
,
csm_scores
):
"""
"""
...
@@ -91,7 +97,7 @@ class SubsectionGrade(SubsectionGradeBase):
...
@@ -91,7 +97,7 @@ class SubsectionGrade(SubsectionGradeBase):
):
):
self
.
_compute_block_score
(
descendant_key
,
course_structure
,
submissions_scores
,
csm_scores
)
self
.
_compute_block_score
(
descendant_key
,
course_structure
,
submissions_scores
,
csm_scores
)
self
.
all_total
,
self
.
graded_total
=
graders
.
aggregate_scores
(
self
.
scores
)
self
.
all_total
,
self
.
graded_total
=
graders
.
aggregate_scores
(
self
.
problem_scores
.
values
()
)
self
.
_log_event
(
log
.
debug
,
u"init_from_structure"
,
student
)
self
.
_log_event
(
log
.
debug
,
u"init_from_structure"
,
student
)
return
self
return
self
...
@@ -180,7 +186,7 @@ class SubsectionGrade(SubsectionGradeBase):
...
@@ -180,7 +186,7 @@ class SubsectionGrade(SubsectionGradeBase):
block
,
block
,
)
)
if
problem_score
:
if
problem_score
:
self
.
locations_to
_scores
[
block_key
]
=
problem_score
self
.
problem
_scores
[
block_key
]
=
problem_score
def
_persisted_model_params
(
self
,
student
):
def
_persisted_model_params
(
self
,
student
):
"""
"""
...
@@ -208,7 +214,7 @@ class SubsectionGrade(SubsectionGradeBase):
...
@@ -208,7 +214,7 @@ class SubsectionGrade(SubsectionGradeBase):
return
[
return
[
BlockRecord
(
location
,
score
.
weight
,
score
.
raw_possible
,
score
.
graded
)
BlockRecord
(
location
,
score
.
weight
,
score
.
raw_possible
,
score
.
graded
)
for
location
,
score
in
for
location
,
score
in
self
.
locations_to
_scores
.
iteritems
()
self
.
problem
_scores
.
iteritems
()
]
]
def
_log_event
(
self
,
log_func
,
log_statement
,
student
):
def
_log_event
(
self
,
log_func
,
log_statement
,
student
):
...
...
lms/djangoapps/grades/tests/test_grades.py
View file @
61c0a01b
...
@@ -203,7 +203,7 @@ class TestWeightedProblems(SharedModuleStoreTestCase):
...
@@ -203,7 +203,7 @@ class TestWeightedProblems(SharedModuleStoreTestCase):
# verify all problem grades
# verify all problem grades
for
problem
in
self
.
problems
:
for
problem
in
self
.
problems
:
problem_score
=
subsection_grade
.
locations_to
_scores
[
problem
.
location
]
problem_score
=
subsection_grade
.
problem
_scores
[
problem
.
location
]
self
.
assertEqual
(
type
(
expected_score
.
first_attempted
),
type
(
problem_score
.
first_attempted
))
self
.
assertEqual
(
type
(
expected_score
.
first_attempted
),
type
(
problem_score
.
first_attempted
))
expected_score
.
first_attempted
=
problem_score
.
first_attempted
expected_score
.
first_attempted
=
problem_score
.
first_attempted
self
.
assertEquals
(
problem_score
,
expected_score
)
self
.
assertEquals
(
problem_score
,
expected_score
)
...
...
lms/djangoapps/grades/tests/test_new.py
View file @
61c0a01b
...
@@ -358,7 +358,7 @@ class ZeroGradeTest(GradeTestBase):
...
@@ -358,7 +358,7 @@ class ZeroGradeTest(GradeTestBase):
chapter_grades
=
ZeroCourseGrade
(
self
.
request
.
user
,
course_data
)
.
chapter_grades
chapter_grades
=
ZeroCourseGrade
(
self
.
request
.
user
,
course_data
)
.
chapter_grades
for
chapter
in
chapter_grades
:
for
chapter
in
chapter_grades
:
for
section
in
chapter_grades
[
chapter
][
'sections'
]:
for
section
in
chapter_grades
[
chapter
][
'sections'
]:
for
score
in
section
.
locations_to
_scores
.
itervalues
():
for
score
in
section
.
problem
_scores
.
itervalues
():
self
.
assertEqual
(
score
.
earned
,
0
)
self
.
assertEqual
(
score
.
earned
,
0
)
self
.
assertEqual
(
score
.
first_attempted
,
None
)
self
.
assertEqual
(
score
.
first_attempted
,
None
)
self
.
assertEqual
(
section
.
all_total
.
earned
,
0
)
self
.
assertEqual
(
section
.
all_total
.
earned
,
0
)
...
...
lms/djangoapps/instructor_task/tasks_helper.py
View file @
61c0a01b
...
@@ -1027,7 +1027,7 @@ def upload_problem_grade_report(_xmodule_instance_args, _entry_id, course_id, _t
...
@@ -1027,7 +1027,7 @@ def upload_problem_grade_report(_xmodule_instance_args, _entry_id, course_id, _t
earned_possible_values
=
[]
earned_possible_values
=
[]
for
block_location
in
graded_scorable_blocks
:
for
block_location
in
graded_scorable_blocks
:
try
:
try
:
problem_score
=
course_grade
.
locations_to
_scores
[
block_location
]
problem_score
=
course_grade
.
problem
_scores
[
block_location
]
except
KeyError
:
except
KeyError
:
earned_possible_values
.
append
([
u'Not Available'
,
u'Not Available'
])
earned_possible_values
.
append
([
u'Not Available'
,
u'Not Available'
])
else
:
else
:
...
...
lms/templates/courseware/progress.html
View file @
61c0a01b
...
@@ -179,10 +179,10 @@ from django.utils.http import urlquote_plus
...
@@ -179,10 +179,10 @@ from django.utils.http import urlquote_plus
<em
class=
"localized-datetime"
data-datetime=
"${section.due}"
data-string=
"${_('due {date}')}"
data-timezone=
"${user_timezone}"
data-language=
"${user_language}"
></em>
<em
class=
"localized-datetime"
data-datetime=
"${section.due}"
data-string=
"${_('due {date}')}"
data-timezone=
"${user_timezone}"
data-language=
"${user_language}"
></em>
%endif
%endif
</p>
</p>
%if len(section.
scores
) > 0:
%if len(section.
problem_scores.values()
) > 0:
<dl
class=
"scores"
>
<dl
class=
"scores"
>
<dt
class=
"hd hd-6"
>
${ _("Problem Scores: ") if section.graded else _("Practice Scores: ")}
</dt>
<dt
class=
"hd hd-6"
>
${ _("Problem Scores: ") if section.graded else _("Practice Scores: ")}
</dt>
%for score in section.
scores
:
%for score in section.
problem_scores.values()
:
<dd>
${"{0:.3n}/{1:.3n}".format(float(score.earned),float(score.possible))}
</dd>
<dd>
${"{0:.3n}/{1:.3n}".format(float(score.earned),float(score.possible))}
</dd>
%endfor
%endfor
</dl>
</dl>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment