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
11142c7c
Commit
11142c7c
authored
Oct 11, 2013
by
Christina Roberts
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1300 from edx/christina/fix-rounding-error
Grading rounding error.
parents
0231f2a3
8c080b6f
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
55 additions
and
9 deletions
+55
-9
cms/djangoapps/contentstore/features/grading.feature
+11
-0
cms/djangoapps/contentstore/features/grading.py
+16
-0
cms/static/coffee/spec/main.coffee
+1
-0
cms/static/coffee/spec/models/settings_course_grader_spec.coffee
+20
-0
cms/static/js/models/settings/course_grader.js
+3
-3
cms/static/js/models/settings/course_grading_policy.js
+2
-2
cms/templates/edit_subsection.html
+1
-2
cms/templates/overview.html
+1
-2
No files found.
cms/djangoapps/contentstore/features/grading.feature
View file @
11142c7c
...
@@ -59,6 +59,17 @@ Feature: CMS.Course Grading
...
@@ -59,6 +59,17 @@ Feature: CMS.Course Grading
And
I go back to the main course page
And
I go back to the main course page
Then
I do see the assignment name
"New Type"
Then
I do see the assignment name
"New Type"
# Note that "7" is a special weight because it revealed rounding errors (STUD-826).
Scenario
:
Users can set weight to Assignment types
Given
I have opened a new course in Studio
And
I am viewing the grading settings
When
I add a new assignment type
"New Type"
And
I set the assignment weight to
"7"
And
I press the
"Save"
notification button
Then
the assignment weight is displayed as
"7"
And
I reload the page
Then
the assignment weight is displayed as
"7"
Scenario
:
Settings are only persisted when saved
Scenario
:
Settings are only persisted when saved
Given
I have opened a new course in Studio
Given
I have opened a new course in Studio
And
I have populated the course
And
I have populated the course
...
...
cms/djangoapps/contentstore/features/grading.py
View file @
11142c7c
...
@@ -106,6 +106,22 @@ def add_assignment_type(step, new_name):
...
@@ -106,6 +106,22 @@ def add_assignment_type(step, new_name):
new_assignment
.
_element
.
send_keys
(
new_name
)
new_assignment
.
_element
.
send_keys
(
new_name
)
@step
(
u'I set the assignment weight to "([^"]*)"$'
)
def
set_weight
(
step
,
weight
):
weight_id
=
'#course-grading-assignment-gradeweight'
weight_field
=
world
.
css_find
(
weight_id
)[
-
1
]
old_weight
=
world
.
css_value
(
weight_id
,
-
1
)
for
count
in
range
(
len
(
old_weight
)):
weight_field
.
_element
.
send_keys
(
Keys
.
END
,
Keys
.
BACK_SPACE
)
weight_field
.
_element
.
send_keys
(
weight
)
@step
(
u'the assignment weight is displayed as "([^"]*)"$'
)
def
verify_weight
(
step
,
weight
):
weight_id
=
'#course-grading-assignment-gradeweight'
assert_equal
(
world
.
css_value
(
weight_id
,
-
1
),
weight
)
@step
(
u'I have populated the course'
)
@step
(
u'I have populated the course'
)
def
populate_course
(
step
):
def
populate_course
(
step
):
step
.
given
(
'I have added a new section'
)
step
.
given
(
'I have added a new section'
)
...
...
cms/static/coffee/spec/main.coffee
View file @
11142c7c
...
@@ -141,6 +141,7 @@ define([
...
@@ -141,6 +141,7 @@ define([
"coffee/spec/models/course_spec"
,
"coffee/spec/models/metadata_spec"
,
"coffee/spec/models/course_spec"
,
"coffee/spec/models/metadata_spec"
,
"coffee/spec/models/module_spec"
,
"coffee/spec/models/section_spec"
,
"coffee/spec/models/module_spec"
,
"coffee/spec/models/section_spec"
,
"coffee/spec/models/settings_course_grader_spec"
,
"coffee/spec/models/settings_grading_spec"
,
"coffee/spec/models/textbook_spec"
,
"coffee/spec/models/settings_grading_spec"
,
"coffee/spec/models/textbook_spec"
,
"coffee/spec/models/upload_spec"
,
"coffee/spec/models/upload_spec"
,
...
...
cms/static/coffee/spec/models/settings_course_grader_spec.coffee
0 → 100644
View file @
11142c7c
define
[
"js/models/settings/course_grader"
],
(
CourseGrader
)
->
describe
"CourseGraderModel"
,
->
describe
"parseWeight"
,
->
it
"converts a float to an integer"
,
->
model
=
new
CourseGrader
({
weight
:
7.0001
,
min_count
:
3.67
,
drop_count
:
1.88
},
{
parse
:
true
})
expect
(
model
.
get
(
'weight'
)).
toBe
(
7
)
expect
(
model
.
get
(
'min_count'
)).
toBe
(
3
)
expect
(
model
.
get
(
'drop_count'
)).
toBe
(
1
)
it
"converts a string to an integer"
,
->
model
=
new
CourseGrader
({
weight
:
'7.0001'
,
min_count
:
'3.67'
,
drop_count
:
'1.88'
},
{
parse
:
true
})
expect
(
model
.
get
(
'weight'
)).
toBe
(
7
)
expect
(
model
.
get
(
'min_count'
)).
toBe
(
3
)
expect
(
model
.
get
(
'drop_count'
)).
toBe
(
1
)
it
"does a no-op for integers"
,
->
model
=
new
CourseGrader
({
weight
:
7
,
min_count
:
3
,
drop_count
:
1
},
{
parse
:
true
})
expect
(
model
.
get
(
'weight'
)).
toBe
(
7
)
expect
(
model
.
get
(
'min_count'
)).
toBe
(
3
)
expect
(
model
.
get
(
'drop_count'
)).
toBe
(
1
)
cms/static/js/models/settings/course_grader.js
View file @
11142c7c
...
@@ -10,13 +10,13 @@ var CourseGrader = Backbone.Model.extend({
...
@@ -10,13 +10,13 @@ var CourseGrader = Backbone.Model.extend({
},
},
parse
:
function
(
attrs
)
{
parse
:
function
(
attrs
)
{
if
(
attrs
[
'weight'
])
{
if
(
attrs
[
'weight'
])
{
if
(
!
_
.
isNumber
(
attrs
.
weight
))
attrs
.
weight
=
parseInt
(
attrs
.
weight
,
10
);
attrs
.
weight
=
parseInt
(
attrs
.
weight
,
10
);
}
}
if
(
attrs
[
'min_count'
])
{
if
(
attrs
[
'min_count'
])
{
if
(
!
_
.
isNumber
(
attrs
.
min_count
))
attrs
.
min_count
=
parseInt
(
attrs
.
min_count
,
10
);
attrs
.
min_count
=
parseInt
(
attrs
.
min_count
,
10
);
}
}
if
(
attrs
[
'drop_count'
])
{
if
(
attrs
[
'drop_count'
])
{
if
(
!
_
.
isNumber
(
attrs
.
drop_count
))
attrs
.
drop_count
=
parseInt
(
attrs
.
drop_count
,
10
);
attrs
.
drop_count
=
parseInt
(
attrs
.
drop_count
,
10
);
}
}
return
attrs
;
return
attrs
;
},
},
...
...
cms/static/js/models/settings/course_grading_policy.js
View file @
11142c7c
...
@@ -17,10 +17,10 @@ var CourseGradingPolicy = Backbone.Model.extend({
...
@@ -17,10 +17,10 @@ var CourseGradingPolicy = Backbone.Model.extend({
// interesting race condition: if {parse:true} when newing, then parse called before .attributes created
// interesting race condition: if {parse:true} when newing, then parse called before .attributes created
if
(
this
.
attributes
&&
this
.
has
(
'graders'
))
{
if
(
this
.
attributes
&&
this
.
has
(
'graders'
))
{
graderCollection
=
this
.
get
(
'graders'
);
graderCollection
=
this
.
get
(
'graders'
);
graderCollection
.
reset
(
attributes
.
graders
);
graderCollection
.
reset
(
attributes
.
graders
,
{
parse
:
true
}
);
}
}
else
{
else
{
graderCollection
=
new
CourseGraderCollection
(
attributes
.
graders
);
graderCollection
=
new
CourseGraderCollection
(
attributes
.
graders
,
{
parse
:
true
}
);
graderCollection
.
course_location
=
attributes
[
'course_location'
]
||
this
.
get
(
'course_location'
);
graderCollection
.
course_location
=
attributes
[
'course_location'
]
||
this
.
get
(
'course_location'
);
}
}
attributes
.
graders
=
graderCollection
;
attributes
.
graders
=
graderCollection
;
...
...
cms/templates/edit_subsection.html
View file @
11142c7c
...
@@ -114,9 +114,8 @@ require(["domReady!", "jquery", "js/models/location", "js/views/overview_assignm
...
@@ -114,9 +114,8 @@ require(["domReady!", "jquery", "js/models/location", "js/views/overview_assignm
// I believe that current (New Section/New Subsection) cause full page reloads which means these aren't needed globally
// I believe that current (New Section/New Subsection) cause full page reloads which means these aren't needed globally
// but we really should change that behavior.
// but we really should change that behavior.
if
(
!
window
.
graderTypes
)
{
if
(
!
window
.
graderTypes
)
{
window
.
graderTypes
=
new
CourseGraderCollection
();
window
.
graderTypes
=
new
CourseGraderCollection
(
$
{
course_graders
|
n
},
{
parse
:
true
}
);
window
.
graderTypes
.
course_location
=
new
Location
(
'${parent_location}'
);
window
.
graderTypes
.
course_location
=
new
Location
(
'${parent_location}'
);
window
.
graderTypes
.
reset
(
$
{
course_graders
|
n
});
}
}
$
(
".gradable-status"
).
each
(
function
(
index
,
ele
)
{
$
(
".gradable-status"
).
each
(
function
(
index
,
ele
)
{
...
...
cms/templates/overview.html
View file @
11142c7c
...
@@ -25,9 +25,8 @@ require(["domReady!", "jquery", "js/models/location", "js/models/section", "js/v
...
@@ -25,9 +25,8 @@ require(["domReady!", "jquery", "js/models/location", "js/models/section", "js/v
// I believe that current (New Section/New Subsection) cause full page reloads which means these aren't needed globally
// I believe that current (New Section/New Subsection) cause full page reloads which means these aren't needed globally
// but we really should change that behavior.
// but we really should change that behavior.
if
(
!
window
.
graderTypes
)
{
if
(
!
window
.
graderTypes
)
{
window
.
graderTypes
=
new
CourseGraderCollection
();
window
.
graderTypes
=
new
CourseGraderCollection
(
$
{
course_graders
|
n
},
{
parse
:
true
}
);
window
.
graderTypes
.
course_location
=
new
Location
(
'${parent_location}'
);
window
.
graderTypes
.
course_location
=
new
Location
(
'${parent_location}'
);
window
.
graderTypes
.
reset
(
$
{
course_graders
|
n
});
}
}
$
(
".gradable-status"
).
each
(
function
(
index
,
ele
)
{
$
(
".gradable-status"
).
each
(
function
(
index
,
ele
)
{
...
...
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