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
4cb03f43
Commit
4cb03f43
authored
Dec 24, 2013
by
zubiar-arbi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Grading types should not allow empty field for "Total Number" and "Number of Droppable"
STUD-988
parent
23dc10d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
cms/static/coffee/spec/models/settings_course_grader_spec.coffee
+7
-0
cms/static/js/models/settings/course_grader.js
+7
-5
No files found.
cms/static/coffee/spec/models/settings_course_grader_spec.coffee
View file @
4cb03f43
...
...
@@ -18,3 +18,10 @@ define ["js/models/settings/course_grader"], (CourseGrader) ->
expect
(
model
.
get
(
'weight'
)).
toBe
(
7
)
expect
(
model
.
get
(
'min_count'
)).
toBe
(
3
)
expect
(
model
.
get
(
'drop_count'
)).
toBe
(
1
)
it
"gives validation error if min_count is less than 1 or drop_count is NaN"
,
->
model
=
new
CourseGrader
()
errors
=
model
.
validate
({
min_count
:
0
,
drop_count
:
''
},
{
validate
:
true
})
expect
(
errors
.
min_count
).
toBe
(
'Please enter an integer greater than 0.'
)
expect
(
errors
.
drop_count
).
toBe
(
'Please enter an integer.'
)
cms/static/js/models/settings/course_grader.js
View file @
4cb03f43
...
...
@@ -50,16 +50,18 @@ var CourseGrader = Backbone.Model.extend({
}
}}
if
(
_
.
has
(
attrs
,
'min_count'
))
{
if
(
!
isFinite
(
attrs
.
min_count
)
||
/
\D
+/
.
test
(
attrs
.
min_count
))
{
errors
.
min_count
=
gettext
(
"Please enter an integer."
);
var
intMinCount
=
parseInt
(
attrs
.
min_count
,
10
);
if
(
!
isFinite
(
intMinCount
)
||
/
\D
+/
.
test
(
intMinCount
)
||
intMinCount
<
1
)
{
errors
.
min_count
=
gettext
(
"Please enter an integer greater than 0."
);
}
else
attrs
.
min_count
=
parseInt
(
attrs
.
min_count
,
10
)
;
else
attrs
.
min_count
=
intMinCount
;
}
if
(
_
.
has
(
attrs
,
'drop_count'
))
{
if
(
!
isFinite
(
attrs
.
drop_count
)
||
/
\D
+/
.
test
(
attrs
.
drop_count
))
{
var
intDropCount
=
parseInt
(
attrs
.
drop_count
,
10
);
if
(
!
isFinite
(
intDropCount
)
||
/
\D
+/
.
test
(
intDropCount
)
||
isNaN
(
intDropCount
))
{
errors
.
drop_count
=
gettext
(
"Please enter an integer."
);
}
else
attrs
.
drop_count
=
parseInt
(
attrs
.
drop_count
,
10
)
;
else
attrs
.
drop_count
=
intDropCount
;
}
if
(
_
.
has
(
attrs
,
'min_count'
)
&&
_
.
has
(
attrs
,
'drop_count'
)
&&
attrs
.
drop_count
>
attrs
.
min_count
)
{
errors
.
drop_count
=
_
.
template
(
...
...
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