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
e9fceb8b
Commit
e9fceb8b
authored
Sep 23, 2015
by
Brian Beggs
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9891 from edx/release
merge release in to master for release 2015-09-22
parents
06998ead
55e2a326
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
38 deletions
+87
-38
lms/djangoapps/courseware/grades.py
+5
-0
lms/djangoapps/instructor_task/tests/test_tasks_helper.py
+81
-37
requirements/edx/github.txt
+1
-1
No files found.
lms/djangoapps/courseware/grades.py
View file @
e9fceb8b
...
@@ -15,6 +15,7 @@ from django.core.cache import cache
...
@@ -15,6 +15,7 @@ from django.core.cache import cache
import
dogstats_wrapper
as
dog_stats_api
import
dogstats_wrapper
as
dog_stats_api
from
courseware
import
courses
from
courseware
import
courses
from
courseware.access
import
has_access
from
courseware.model_data
import
FieldDataCache
,
ScoresClient
from
courseware.model_data
import
FieldDataCache
,
ScoresClient
from
student.models
import
anonymous_id_for_user
from
student.models
import
anonymous_id_for_user
from
util.module_utils
import
yield_dynamic_descriptor_descendants
from
util.module_utils
import
yield_dynamic_descriptor_descendants
...
@@ -405,6 +406,10 @@ def _grade(student, request, course, keep_raw_scores, field_data_cache, scores_c
...
@@ -405,6 +406,10 @@ def _grade(student, request, course, keep_raw_scores, field_data_cache, scores_c
descendants
=
yield_dynamic_descriptor_descendants
(
section_descriptor
,
student
.
id
,
create_module
)
descendants
=
yield_dynamic_descriptor_descendants
(
section_descriptor
,
student
.
id
,
create_module
)
for
module_descriptor
in
descendants
:
for
module_descriptor
in
descendants
:
user_access
=
has_access
(
student
,
'load'
,
module_descriptor
,
module_descriptor
.
location
.
course_key
)
if
not
user_access
:
continue
(
correct
,
total
)
=
get_score
(
(
correct
,
total
)
=
get_score
(
student
,
student
,
module_descriptor
,
module_descriptor
,
...
...
lms/djangoapps/instructor_task/tests/test_tasks_helper.py
View file @
e9fceb8b
...
@@ -9,6 +9,7 @@ Tests that CSV grade report generation works with unicode emails.
...
@@ -9,6 +9,7 @@ Tests that CSV grade report generation works with unicode emails.
import
ddt
import
ddt
from
mock
import
Mock
,
patch
from
mock
import
Mock
,
patch
import
tempfile
import
tempfile
from
openedx.core.djangoapps.course_groups
import
cohorts
import
unicodecsv
import
unicodecsv
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
...
@@ -662,7 +663,7 @@ class TestProblemReportCohortedContent(TestReportMixin, ContentGroupTestCase, In
...
@@ -662,7 +663,7 @@ class TestProblemReportCohortedContent(TestReportMixin, ContentGroupTestCase, In
"""
"""
def
setUp
(
self
):
def
setUp
(
self
):
super
(
TestProblemReportCohortedContent
,
self
)
.
setUp
()
super
(
TestProblemReportCohortedContent
,
self
)
.
setUp
()
# con
t
struct cohorted problems to work on.
# construct cohorted problems to work on.
self
.
add_course_content
()
self
.
add_course_content
()
vertical
=
ItemFactory
.
create
(
vertical
=
ItemFactory
.
create
(
parent_location
=
self
.
problem_section
.
location
,
parent_location
=
self
.
problem_section
.
location
,
...
@@ -681,6 +682,23 @@ class TestProblemReportCohortedContent(TestReportMixin, ContentGroupTestCase, In
...
@@ -681,6 +682,23 @@ class TestProblemReportCohortedContent(TestReportMixin, ContentGroupTestCase, In
group_access
=
{
self
.
course
.
user_partitions
[
0
]
.
id
:
[
self
.
course
.
user_partitions
[
0
]
.
groups
[
1
]
.
id
]}
group_access
=
{
self
.
course
.
user_partitions
[
0
]
.
id
:
[
self
.
course
.
user_partitions
[
0
]
.
groups
[
1
]
.
id
]}
)
)
def
_format_user_grade
(
self
,
header_row
,
user
,
grade
):
"""
Helper method that format the user grade
Args:
header_row(list): header row of csv containing Student ID, Email, Username etc
user(object): Django user object
grade(list): Users' grade list
"""
return
dict
(
zip
(
header_row
,
[
unicode
(
user
.
id
),
user
.
email
,
user
.
username
,
]
+
grade
))
def
test_cohort_content
(
self
):
def
test_cohort_content
(
self
):
self
.
submit_student_answer
(
self
.
alpha_user
.
username
,
u'Pröblem0'
,
[
'Option 1'
,
'Option 1'
])
self
.
submit_student_answer
(
self
.
alpha_user
.
username
,
u'Pröblem0'
,
[
'Option 1'
,
'Option 1'
])
resp
=
self
.
submit_student_answer
(
self
.
alpha_user
.
username
,
u'Pröblem1'
,
[
'Option 1'
,
'Option 1'
])
resp
=
self
.
submit_student_answer
(
self
.
alpha_user
.
username
,
u'Pröblem1'
,
[
'Option 1'
,
'Option 1'
])
...
@@ -695,49 +713,75 @@ class TestProblemReportCohortedContent(TestReportMixin, ContentGroupTestCase, In
...
@@ -695,49 +713,75 @@ class TestProblemReportCohortedContent(TestReportMixin, ContentGroupTestCase, In
self
.
assertDictContainsSubset
(
self
.
assertDictContainsSubset
(
{
'action_name'
:
'graded'
,
'attempted'
:
4
,
'succeeded'
:
4
,
'failed'
:
0
},
result
{
'action_name'
:
'graded'
,
'attempted'
:
4
,
'succeeded'
:
4
,
'failed'
:
0
},
result
)
)
problem_names
=
[
u'Homework 1: Problem - Pröblem0'
,
u'Homework 1: Problem - Pröblem1'
]
problem_names
=
[
u'Homework 1: Problem - Pröblem0'
,
u'Homework 1: Problem - Pröblem1'
]
header_row
=
[
u'Student ID'
,
u'Email'
,
u'Username'
,
u'Final Grade'
]
header_row
=
[
u'Student ID'
,
u'Email'
,
u'Username'
,
u'Final Grade'
]
for
problem
in
problem_names
:
for
problem
in
problem_names
:
header_row
+=
[
problem
+
' (Earned)'
,
problem
+
' (Possible)'
]
header_row
+=
[
problem
+
' (Earned)'
,
problem
+
' (Possible)'
]
self
.
verify_rows_in_csv
([
user_grades
=
[
dict
(
zip
(
{
'user'
:
self
.
staff_user
,
'grade'
:
[
u'0.0'
,
u'N/A'
,
u'N/A'
,
u'N/A'
,
u'N/A'
]},
header_row
,
{
'user'
:
self
.
alpha_user
,
'grade'
:
[
u'1.0'
,
u'2.0'
,
u'2.0'
,
u'N/A'
,
u'N/A'
]},
[
{
'user'
:
self
.
beta_user
,
'grade'
:
[
u'0.5'
,
u'N/A'
,
u'N/A'
,
u'1.0'
,
u'2.0'
]},
unicode
(
self
.
staff_user
.
id
),
{
'user'
:
self
.
non_cohorted_user
,
'grade'
:
[
u'0.0'
,
u'N/A'
,
u'N/A'
,
u'N/A'
,
u'N/A'
]},
self
.
staff_user
.
email
,
self
.
staff_user
.
username
,
u'0.0'
,
u'N/A'
,
u'N/A'
,
u'N/A'
,
u'N/A'
]
]
)),
dict
(
zip
(
# Verify generated grades and expected grades match
header_row
,
expected_grades
=
[
self
.
_format_user_grade
(
header_row
,
**
user_grade
)
for
user_grade
in
user_grades
]
[
self
.
verify_rows_in_csv
(
expected_grades
)
unicode
(
self
.
alpha_user
.
id
),
self
.
alpha_user
.
email
,
@patch
(
'courseware.grades.MaxScoresCache.get'
,
Mock
(
return_value
=
1
))
self
.
alpha_user
.
username
,
def
test_cohort_content_with_maxcache
(
self
):
u'1.0'
,
u'2.0'
,
u'2.0'
,
u'N/A'
,
u'N/A'
"""
]
Tests the cohoted course grading to test the scenario in which `max_scores_cache` is set for the course
)),
problems.
dict
(
zip
(
"""
header_row
,
# Course is cohorted
[
self
.
assertTrue
(
cohorts
.
is_course_cohorted
(
self
.
course
.
id
))
unicode
(
self
.
beta_user
.
id
),
self
.
beta_user
.
email
,
# Verify user groups
self
.
beta_user
.
username
,
self
.
assertEquals
(
u'0.5'
,
u'N/A'
,
u'N/A'
,
u'1.0'
,
u'2.0'
cohorts
.
get_cohort
(
self
.
alpha_user
,
self
.
course
.
id
)
.
id
,
]
self
.
course
.
user_partitions
[
0
]
.
groups
[
0
]
.
id
,
)),
"alpha_user should be assigned to the correct cohort"
dict
(
zip
(
)
header_row
,
self
.
assertEquals
(
[
cohorts
.
get_cohort
(
self
.
beta_user
,
self
.
course
.
id
)
.
id
,
unicode
(
self
.
non_cohorted_user
.
id
),
self
.
course
.
user_partitions
[
0
]
.
groups
[
1
]
.
id
,
self
.
non_cohorted_user
.
email
,
"beta_user should be assigned to the correct cohort"
self
.
non_cohorted_user
.
username
,
)
u'0.0'
,
u'N/A'
,
u'N/A'
,
u'N/A'
,
u'N/A'
# Verify user enrollment
for
user
in
[
self
.
alpha_user
,
self
.
beta_user
,
self
.
non_cohorted_user
]:
self
.
assertTrue
(
CourseEnrollment
.
is_enrolled
(
user
,
self
.
course
.
id
))
self
.
submit_student_answer
(
self
.
alpha_user
.
username
,
u'Pröblem0'
,
[
'Option 1'
,
'Option 1'
])
resp
=
self
.
submit_student_answer
(
self
.
alpha_user
.
username
,
u'Pröblem1'
,
[
'Option 1'
,
'Option 1'
])
self
.
assertEqual
(
resp
.
status_code
,
404
)
resp
=
self
.
submit_student_answer
(
self
.
beta_user
.
username
,
u'Pröblem0'
,
[
'Option 1'
,
'Option 2'
])
self
.
assertEqual
(
resp
.
status_code
,
404
)
self
.
submit_student_answer
(
self
.
beta_user
.
username
,
u'Pröblem1'
,
[
'Option 1'
,
'Option 2'
])
with
patch
(
'instructor_task.tasks_helper._get_current_task'
):
result
=
upload_problem_grade_report
(
None
,
None
,
self
.
course
.
id
,
None
,
'graded'
)
self
.
assertDictContainsSubset
(
{
'action_name'
:
'graded'
,
'attempted'
:
4
,
'succeeded'
:
4
,
'failed'
:
0
},
result
)
problem_names
=
[
u'Homework 1: Problem - Pröblem0'
,
u'Homework 1: Problem - Pröblem1'
]
header_row
=
[
u'Student ID'
,
u'Email'
,
u'Username'
,
u'Final Grade'
]
for
problem
in
problem_names
:
header_row
+=
[
problem
+
' (Earned)'
,
problem
+
' (Possible)'
]
user_grades
=
[
{
'user'
:
self
.
staff_user
,
'grade'
:
[
u'0.0'
,
u'N/A'
,
u'N/A'
,
u'N/A'
,
u'N/A'
]},
{
'user'
:
self
.
alpha_user
,
'grade'
:
[
u'1.0'
,
u'2.0'
,
u'2.0'
,
u'N/A'
,
u'N/A'
]},
{
'user'
:
self
.
beta_user
,
'grade'
:
[
u'0.5'
,
u'N/A'
,
u'N/A'
,
u'1.0'
,
u'2.0'
]},
{
'user'
:
self
.
non_cohorted_user
,
'grade'
:
[
u'0.0'
,
u'N/A'
,
u'N/A'
,
u'N/A'
,
u'N/A'
]},
]
]
)),
])
# Verify generated grades and expected grades match
expected_grades
=
[
self
.
_format_user_grade
(
header_row
,
**
grade
)
for
grade
in
user_grades
]
self
.
verify_rows_in_csv
(
expected_grades
)
@ddt.ddt
@ddt.ddt
...
...
requirements/edx/github.txt
View file @
e9fceb8b
...
@@ -58,7 +58,7 @@ git+https://github.com/edx/ecommerce-api-client.git@1.1.0#egg=ecommerce-api-clie
...
@@ -58,7 +58,7 @@ git+https://github.com/edx/ecommerce-api-client.git@1.1.0#egg=ecommerce-api-clie
-e git+https://github.com/edx/edx-user-state-client.git@30c0ad4b9f57f8d48d6943eb585ec8a9205f4469#egg=edx-user-state-client
-e git+https://github.com/edx/edx-user-state-client.git@30c0ad4b9f57f8d48d6943eb585ec8a9205f4469#egg=edx-user-state-client
git+https://github.com/edx/edx-organizations.git@release-2015-09-22#egg=edx-organizations==0.1.6
git+https://github.com/edx/edx-organizations.git@release-2015-09-22#egg=edx-organizations==0.1.6
git+https://github.com/edx/edx-proctoring.git@0.9.6
b#egg=edx-proctoring==0.9.6b
git+https://github.com/edx/edx-proctoring.git@0.9.6
e#egg=edx-proctoring==0.9.6e
# Third Party XBlocks
# Third Party XBlocks
-e git+https://github.com/mitodl/edx-sga@172a90fd2738f8142c10478356b2d9ed3e55334a#egg=edx-sga
-e git+https://github.com/mitodl/edx-sga@172a90fd2738f8142c10478356b2d9ed3e55334a#egg=edx-sga
...
...
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