Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
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
OpenEdx
problem-builder
Commits
f11afb76
Commit
f11afb76
authored
Apr 03, 2014
by
Alan Boudreault
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
strip the answer when validating the min_characters
parent
c47fed9b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
5 deletions
+8
-5
mentoring/answer.py
+2
-2
mentoring/mrq.py
+4
-2
mentoring/public/js/answer.js
+2
-1
No files found.
mentoring/answer.py
View file @
f11afb76
...
...
@@ -52,7 +52,7 @@ class AnswerBlock(LightChild):
default_from
=
String
(
help
=
"If specified, the name of the answer to get the default value from"
,
default
=
None
,
scope
=
Scope
.
content
)
min_characters
=
Integer
(
help
=
"Minimum number of characters allowed for the answer"
,
scope
=
Scope
.
content
)
default
=
0
,
scope
=
Scope
.
content
)
@lazy
def
student_input
(
self
):
...
...
@@ -110,7 +110,7 @@ class AnswerBlock(LightChild):
def
completed
(
self
):
answer_length_ok
=
self
.
student_input
if
self
.
min_characters
>
0
:
answer_length_ok
=
len
(
self
.
student_input
)
>=
self
.
min_characters
answer_length_ok
=
len
(
self
.
student_input
.
strip
()
)
>=
self
.
min_characters
return
bool
(
self
.
read_only
or
answer_length_ok
)
...
...
mentoring/mrq.py
View file @
f11afb76
...
...
@@ -43,8 +43,10 @@ class MRQBlock(QuestionnaireAbstractBlock):
An XBlock used to ask multiple-response questions
"""
student_choices
=
List
(
help
=
"Last submissions by the student"
,
default
=
[],
scope
=
Scope
.
user_state
)
max_attempts
=
Integer
(
help
=
"Number of max attempts for this questions"
,
scope
=
Scope
.
content
)
num_attempts
=
Integer
(
help
=
"Number of attempts a user has answered for this questions"
,
scope
=
Scope
.
user_state
)
max_attempts
=
Integer
(
help
=
"Number of max attempts for this questions"
,
default
=
0
,
scope
=
Scope
.
content
)
num_attempts
=
Integer
(
help
=
"Number of attempts a user has answered for this questions"
,
default
=
0
,
scope
=
Scope
.
user_state
)
# TODO REMOVE THIS, ONLY NEEDED FOR LIGHTCHILDREN
@classmethod
...
...
mentoring/public/js/answer.js
View file @
f11afb76
...
...
@@ -2,7 +2,8 @@ function AnswerBlock(runtime, element) {
return
{
submit
:
function
()
{
var
input
=
$
(
':input'
,
element
),
answer_length
=
input
.
val
().
length
,
input_value
=
input
.
val
().
replace
(
/^
\s
+|
\s
+$/gm
,
''
),
answer_length
=
input_value
.
length
,
data
=
input
.
data
();
if
(
_
.
isNumber
(
data
.
min_characters
)
&&
...
...
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