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
4599ffbb
Commit
4599ffbb
authored
Aug 16, 2017
by
Chandrakant Gopalan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OC-2959 freeform and MCQ submitted values are a json and not an array
parent
681cbda7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
5 deletions
+11
-5
problem_builder/answer.py
+1
-1
problem_builder/mcq.py
+2
-2
problem_builder/public/js/answer.js
+7
-1
problem_builder/public/js/questionnaire.js
+1
-1
No files found.
problem_builder/answer.py
View file @
4599ffbb
...
...
@@ -223,7 +223,7 @@ class AnswerBlock(SubmittingXBlockMixin, AnswerMixin, QuestionMixin, StudioEdita
The parent block is handling a student submission, including a new answer for this
block. Update accordingly.
"""
self
.
student_input
=
submission
[
0
][
'value'
]
.
strip
()
self
.
student_input
=
submission
[
'value'
]
.
strip
()
self
.
save
()
if
sub_api
:
...
...
problem_builder/mcq.py
View file @
4599ffbb
...
...
@@ -125,8 +125,8 @@ class MCQBlock(SubmittingXBlockMixin, StudentViewUserStateMixin, QuestionnaireAb
def
submit
(
self
,
submission
):
log
.
debug
(
u'Received MCQ submission: "
%
s"'
,
submission
)
result
=
self
.
calculate_results
(
submission
)
self
.
student_choice
=
submission
result
=
self
.
calculate_results
(
submission
[
'value'
]
)
self
.
student_choice
=
submission
[
'value'
]
log
.
debug
(
u'MCQ submission result:
%
s'
,
result
)
return
result
...
...
problem_builder/public/js/answer.js
View file @
4599ffbb
...
...
@@ -15,7 +15,13 @@ function AnswerBlock(runtime, element) {
},
submit
:
function
()
{
return
$
(
':input'
,
element
).
serializeArray
();
var
freeform_answer
=
$
(
':input'
,
element
);
if
(
freeform_answer
.
length
)
{
return
{
"value"
:
freeform_answer
.
val
()};
}
else
{
return
null
;
}
},
handleReview
:
function
(
result
)
{
...
...
problem_builder/public/js/questionnaire.js
View file @
4599ffbb
...
...
@@ -107,7 +107,7 @@ function MCQBlock(runtime, element) {
var
checkedRadio
=
$
(
'input[type=radio]:checked'
,
element
);
if
(
checkedRadio
.
length
)
{
return
checkedRadio
.
val
()
;
return
{
"value"
:
checkedRadio
.
val
()}
;
}
else
{
return
null
;
}
...
...
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