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
c6c92230
Commit
c6c92230
authored
Sep 28, 2015
by
George Schneeloch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed min_count KeyError
parent
11fb4f66
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
1 deletions
+55
-1
lms/djangoapps/ccx/tests/test_views.py
+54
-0
lms/djangoapps/ccx/views.py
+1
-1
No files found.
lms/djangoapps/ccx/tests/test_views.py
View file @
c6c92230
...
...
@@ -265,6 +265,60 @@ class TestCoachDashboard(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
self
.
assertEqual
(
policy
[
'GRADER'
][
3
][
'type'
],
'Final Exam'
)
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
):
"""enroll a list of students who are members of the class
"""
...
...
lms/djangoapps/ccx/views.py
View file @
c6c92230
...
...
@@ -254,7 +254,7 @@ def save_ccx(request, course, ccx=None):
grader
=
policy
[
'GRADER'
]
for
section
in
grader
:
count
=
graded
.
get
(
section
.
get
(
'type'
),
0
)
if
count
<
section
[
'min_count'
]
:
if
count
<
section
.
get
(
'min_count'
,
0
)
:
changed
=
True
section
[
'min_count'
]
=
count
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