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
5ea5a7c0
Commit
5ea5a7c0
authored
Dec 10, 2012
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
It works!!!
parent
c43aa62f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
10 deletions
+25
-10
cms/djangoapps/contentstore/views.py
+1
-0
cms/djangoapps/models/settings/course_grading.py
+6
-3
cms/static/js/models/settings/course_grading_policy.js
+5
-5
cms/static/js/views/settings/main_settings_view.js
+13
-2
No files found.
cms/djangoapps/contentstore/views.py
View file @
5ea5a7c0
...
...
@@ -1006,6 +1006,7 @@ def course_grader_updates(request, org, course, name, grader_index=None):
elif
real_method
==
"DELETE"
:
# ??? Shoudl this return anything? Perhaps success fail?
CourseGradingModel
.
delete_grader
(
Location
([
'i4x'
,
org
,
course
,
'course'
,
name
]),
grader_index
)
return
HttpResponse
()
elif
request
.
method
==
'POST'
:
# post or put, doesn't matter.
return
HttpResponse
(
json
.
dumps
(
CourseGradingModel
.
update_grader_from_json
(
Location
([
'i4x'
,
org
,
course
,
'course'
,
name
]),
request
.
POST
)),
mimetype
=
"application/json"
)
...
...
cms/djangoapps/models/settings/course_grading.py
View file @
5ea5a7c0
...
...
@@ -41,8 +41,8 @@ class CourseGradingModel:
descriptor
=
get_modulestore
(
course_location
)
.
get_item
(
course_location
)
# # ??? it would be good if these had the course_location in them so that they stand alone sufficiently
# # but that would require not using CourseDescriptor's field directly. Opinions?
# FIXME how do I tell it to ignore index? Is there another iteration mech I should use?
index
=
int
(
index
)
if
len
(
descriptor
.
raw_grader
)
>
index
:
return
CourseGradingModel
.
jsonize_grader
(
index
,
descriptor
.
raw_grader
[
index
])
...
...
@@ -113,7 +113,7 @@ class CourseGradingModel:
# # but that would require not using CourseDescriptor's field directly. Opinions?
# parse removes the id; so, grab it before parse
index
=
grader
.
get
(
'id'
,
None
)
index
=
int
(
grader
.
get
(
'id'
,
len
(
descriptor
.
raw_grader
))
)
grader
=
CourseGradingModel
.
parse_grader
(
grader
)
if
index
<
len
(
descriptor
.
raw_grader
):
...
...
@@ -172,8 +172,11 @@ class CourseGradingModel:
course_location
=
Location
(
course_location
)
descriptor
=
get_modulestore
(
course_location
)
.
get_item
(
course_location
)
index
=
int
(
index
)
if
index
<
len
(
descriptor
.
raw_grader
):
del
descriptor
.
raw_grader
[
index
]
# force propagation to defintion
descriptor
.
raw_grader
=
descriptor
.
raw_grader
get_modulestore
(
course_location
)
.
update_item
(
course_location
,
descriptor
.
definition
[
'data'
])
# NOTE cannot delete cutoffs. May be useful to reset
...
...
cms/static/js/models/settings/course_grading_policy.js
View file @
5ea5a7c0
...
...
@@ -37,7 +37,7 @@ CMS.Models.Settings.CourseGradingPolicy = Backbone.Model.extend({
CMS
.
Models
.
Settings
.
CourseGrader
=
Backbone
.
Model
.
extend
({
defaults
:
{
"type"
:
""
,
// must be unique w/in collection (ie. w/in course)
"min_count"
:
0
,
"min_count"
:
1
,
"drop_count"
:
0
,
"short_label"
:
""
,
// what to use in place of type if space is an issue
"weight"
:
0
// int 0..100
...
...
@@ -73,7 +73,7 @@ CMS.Models.Settings.CourseGrader = Backbone.Model.extend({
}
}
if
(
attrs
[
'weight'
])
{
if
(
!
isFinite
(
attrs
.
weight
)
||
!
parseIn
t
(
attrs
.
weight
))
{
if
(
!
isFinite
(
attrs
.
weight
)
||
/
\D
+/
.
tes
t
(
attrs
.
weight
))
{
errors
.
weight
=
"Please enter an integer between 0 and 100."
;
}
else
{
...
...
@@ -87,13 +87,13 @@ CMS.Models.Settings.CourseGrader = Backbone.Model.extend({
}
}}
if
(
attrs
[
'min_count'
])
{
if
(
!
isFinite
(
attrs
.
min_count
)
||
!
parseIn
t
(
attrs
.
min_count
))
{
if
(
!
isFinite
(
attrs
.
min_count
)
||
/
\D
+/
.
tes
t
(
attrs
.
min_count
))
{
errors
.
min_count
=
"Please enter an integer."
;
}
else
attrs
.
min_count
=
parseInt
(
attrs
.
min_count
);
}
if
(
attrs
[
'drop_count'
])
{
if
(
!
isFinite
(
attrs
.
drop_count
)
||
!
parseIn
t
(
attrs
.
drop_count
))
{
if
(
!
isFinite
(
attrs
.
drop_count
)
||
/
\D
+/
.
tes
t
(
attrs
.
drop_count
))
{
errors
.
drop_count
=
"Please enter an integer."
;
}
else
attrs
.
drop_count
=
parseInt
(
attrs
.
drop_count
);
...
...
@@ -109,7 +109,7 @@ CMS.Models.Settings.CourseGraderCollection = Backbone.Collection.extend({
model
:
CMS
.
Models
.
Settings
.
CourseGrader
,
course_location
:
null
,
// must be set to a Location object
url
:
function
()
{
return
'/'
+
this
.
course_location
.
get
(
'org'
)
+
"/"
+
this
.
course_location
.
get
(
'course'
)
+
'/grades/'
+
this
.
course_location
.
get
(
'name'
);
return
'/'
+
this
.
course_location
.
get
(
'org'
)
+
"/"
+
this
.
course_location
.
get
(
'course'
)
+
'/grades/'
+
this
.
course_location
.
get
(
'name'
)
+
'/'
;
},
sumWeights
:
function
()
{
return
this
.
reduce
(
function
(
subtotal
,
grader
)
{
return
subtotal
+
grader
.
get
(
'weight'
);
},
0
);
...
...
cms/static/js/views/settings/main_settings_view.js
View file @
5ea5a7c0
...
...
@@ -265,7 +265,8 @@ CMS.Views.Settings.Grading = CMS.Views.ValidatingView.extend({
"blur span[contenteditable=true]"
:
"updateDesignation"
,
"click .settings-extra header"
:
"showSettingsExtras"
,
"click .new-grade-button"
:
"addNewGrade"
,
"click .remove-button"
:
"removeGrade"
"click .remove-button"
:
"removeGrade"
,
"click .add-grading-data"
:
"addAssignmentType"
},
initialize
:
function
()
{
// load template for grading view
...
...
@@ -299,6 +300,8 @@ CMS.Views.Settings.Grading = CMS.Views.ValidatingView.extend({
}
);
this
.
model
.
on
(
'error'
,
this
.
handleValidationError
,
this
);
this
.
model
.
get
(
'graders'
).
on
(
'remove'
,
this
.
render
,
this
);
this
.
model
.
get
(
'graders'
).
on
(
'add'
,
this
.
render
,
this
);
this
.
selectorToField
=
_
.
invert
(
this
.
fieldToSelectorMap
);
},
...
...
@@ -323,6 +326,9 @@ CMS.Views.Settings.Grading = CMS.Views.ValidatingView.extend({
return
this
;
},
addAssignmentType
:
function
()
{
this
.
model
.
get
(
'graders'
).
push
({});
},
fieldToSelectorMap
:
{
'grace_period'
:
'course-grading-graceperiod'
},
...
...
@@ -545,7 +551,8 @@ CMS.Views.Settings.GraderView = CMS.Views.ValidatingView.extend({
// Model class is CMS.Models.Settings.CourseGrader
events
:
{
"blur input"
:
"updateModel"
,
"blur textarea"
:
"updateModel"
"blur textarea"
:
"updateModel"
,
"click .remove-grading-data"
:
"deleteModel"
},
initialize
:
function
()
{
this
.
model
.
on
(
'error'
,
this
.
handleValidationError
,
this
);
...
...
@@ -577,6 +584,9 @@ CMS.Views.Settings.GraderView = CMS.Views.ValidatingView.extend({
break
;
}
},
deleteModel
:
function
()
{
this
.
model
.
destroy
();
}
});
\ No newline at end of file
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