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
972196fe
Commit
972196fe
authored
Oct 01, 2015
by
Sarina Canelake
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9978 from mitocw/fix/gs/min_count_keyerror
Fixed KeyError in CCX
parents
cdd59b5a
3284b7e4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
1 deletions
+56
-1
AUTHORS
+1
-0
lms/djangoapps/ccx/tests/test_views.py
+54
-0
lms/djangoapps/ccx/views.py
+1
-1
No files found.
AUTHORS
View file @
972196fe
...
@@ -243,3 +243,4 @@ Michael Frey <mfrey@edx.org>
...
@@ -243,3 +243,4 @@ Michael Frey <mfrey@edx.org>
Hasnain Naveed <hasnain@edx.org>
Hasnain Naveed <hasnain@edx.org>
J. Cliff Dyer <cdyer@edx.org>
J. Cliff Dyer <cdyer@edx.org>
Jamie Folsom <jfolsom@mit.edu>
Jamie Folsom <jfolsom@mit.edu>
George Schneeloch <gschneel@mit.edu>
lms/djangoapps/ccx/tests/test_views.py
View file @
972196fe
...
@@ -265,6 +265,60 @@ class TestCoachDashboard(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
...
@@ -265,6 +265,60 @@ class TestCoachDashboard(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
self
.
assertEqual
(
policy
[
'GRADER'
][
3
][
'type'
],
'Final Exam'
)
self
.
assertEqual
(
policy
[
'GRADER'
][
3
][
'type'
],
'Final Exam'
)
self
.
assertEqual
(
policy
[
'GRADER'
][
3
][
'min_count'
],
0
)
self
.
assertEqual
(
policy
[
'GRADER'
][
3
][
'min_count'
],
0
)
@patch
(
'ccx.views.render_to_response'
,
intercept_renderer
)
def
test_save_without_min_count
(
self
):
"""
POST grading policy without min_count field.
"""
self
.
make_coach
()
ccx
=
self
.
make_ccx
()
course_id
=
CCXLocator
.
from_course_locator
(
self
.
course
.
id
,
ccx
.
id
)
save_policy_url
=
reverse
(
'ccx_set_grading_policy'
,
kwargs
=
{
'course_id'
:
course_id
})
# This policy doesn't include a min_count field
policy
=
{
"GRADE_CUTOFFS"
:
{
"Pass"
:
0.5
},
"GRADER"
:
[
{
"weight"
:
0.15
,
"type"
:
"Homework"
,
"drop_count"
:
2
,
"short_label"
:
"HW"
}
]
}
response
=
self
.
client
.
post
(
save_policy_url
,
{
"policy"
:
json
.
dumps
(
policy
)}
)
self
.
assertEqual
(
response
.
status_code
,
302
)
ccx
=
CustomCourseForEdX
.
objects
.
get
()
# Make sure grading policy adjusted
policy
=
get_override_for_ccx
(
ccx
,
self
.
course
,
'grading_policy'
,
self
.
course
.
grading_policy
)
self
.
assertEqual
(
len
(
policy
[
'GRADER'
]),
1
)
self
.
assertEqual
(
policy
[
'GRADER'
][
0
][
'type'
],
'Homework'
)
self
.
assertNotIn
(
'min_count'
,
policy
[
'GRADER'
][
0
])
save_ccx_url
=
reverse
(
'save_ccx'
,
kwargs
=
{
'course_id'
:
course_id
})
coach_dashboard_url
=
reverse
(
'ccx_coach_dashboard'
,
kwargs
=
{
'course_id'
:
course_id
}
)
response
=
self
.
client
.
get
(
coach_dashboard_url
)
schedule
=
json
.
loads
(
response
.
mako_context
[
'schedule'
])
# pylint: disable=no-member
response
=
self
.
client
.
post
(
save_ccx_url
,
json
.
dumps
(
schedule
),
content_type
=
'application/json'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_enroll_member_student
(
self
):
def
test_enroll_member_student
(
self
):
"""enroll a list of students who are members of the class
"""enroll a list of students who are members of the class
"""
"""
...
...
lms/djangoapps/ccx/views.py
View file @
972196fe
...
@@ -254,7 +254,7 @@ def save_ccx(request, course, ccx=None):
...
@@ -254,7 +254,7 @@ def save_ccx(request, course, ccx=None):
grader
=
policy
[
'GRADER'
]
grader
=
policy
[
'GRADER'
]
for
section
in
grader
:
for
section
in
grader
:
count
=
graded
.
get
(
section
.
get
(
'type'
),
0
)
count
=
graded
.
get
(
section
.
get
(
'type'
),
0
)
if
count
<
section
[
'min_count'
]
:
if
count
<
section
.
get
(
'min_count'
,
0
)
:
changed
=
True
changed
=
True
section
[
'min_count'
]
=
count
section
[
'min_count'
]
=
count
if
changed
:
if
changed
:
...
...
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