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
93a7b061
Commit
93a7b061
authored
Nov 23, 2013
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implements quizz submit() workflow, Adds per-sublock completion criteria
parent
00fb2cc2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
5 deletions
+31
-5
mentoring/answer.py
+4
-1
mentoring/mentoring.py
+1
-1
mentoring/quizz.py
+10
-1
static/html/mentoring.html
+1
-0
static/js/mentoring.js
+2
-0
static/js/quizz.js
+13
-2
No files found.
mentoring/answer.py
View file @
93a7b061
...
...
@@ -66,7 +66,10 @@ class AnswerBlock(XBlock):
if
not
self
.
read_only
:
self
.
student_input
=
submission
[
0
][
'value'
]
log
.
info
(
u'Answer submitted for`{}`: "{}"'
.
format
(
self
.
name
,
self
.
student_input
))
return
self
.
student_input
return
{
'student_input'
:
self
.
student_input
,
'completed'
:
bool
(
self
.
student_input
),
}
def
save
(
self
):
"""
...
...
mentoring/mentoring.py
View file @
93a7b061
...
...
@@ -88,7 +88,7 @@ class MentoringBlock(XBlock):
child
=
child_map
[
input_name
]
submit_results
[
input_name
]
=
child
.
submit
(
submission
)
child
.
save
()
completed
=
completed
and
submit_results
[
input_name
]
completed
=
completed
and
submit_results
[
input_name
]
[
'completed'
]
self
.
completed
=
bool
(
completed
)
...
...
mentoring/quizz.py
View file @
93a7b061
...
...
@@ -87,7 +87,16 @@ class QuizzBlock(XBlock):
def
submit
(
self
,
submission
):
# TODO
log
.
info
(
u'submission:
%
s'
,
submission
)
completed
=
bool
(
submission
)
return
{
'submission'
:
submission
,
'completed'
:
completed
,
'tip'
:
'submission: {}, completed: {}'
.
format
(
submission
,
completed
)
}
#self.student_input = submission[0]['value']
#log.info(u'Answer submitted for`{}`: "{}"'.format(self.name, self.student_input))
return
self
.
student_input
#return self.student_choice
static/html/mentoring.html
View file @
93a7b061
...
...
@@ -6,4 +6,5 @@
<span
class=
"progress"
data-completed=
"{{ self.completed }}"
>
<span
class=
'indicator'
></span>
</span>
<div
class=
"quizz-tips"
></div>
</div>
static/js/mentoring.js
View file @
93a7b061
...
...
@@ -15,6 +15,8 @@ function MentoringBlock(runtime, element) {
}
function
handleSubmitResults
(
results
)
{
$
(
'.quizz-tips'
,
element
).
empty
();
$
.
each
(
results
.
submitResults
||
{},
function
(
input
,
result
)
{
callIfExists
(
runtime
.
childMap
(
element
,
input
),
'handleSubmit'
,
result
);
});
...
...
static/js/quizz.js
View file @
93a7b061
function
QuizzBlock
(
runtime
,
element
)
{
return
{
submit
:
function
()
{
return
$
(
element
).
find
(
':input'
).
serializeArray
();
var
checked_radio
=
$
(
'input[type=radio]:checked'
,
element
);
if
(
checked_radio
.
length
)
{
return
checked_radio
.
val
();
}
else
{
return
null
;
}
},
handleSubmit
:
function
(
result
)
{
$
(
element
).
find
(
'.message'
).
text
((
result
||
{}).
error
||
''
);
var
tips_dom
=
$
(
element
).
parent
().
find
(
'.quizz-tips'
),
tip_text
=
(
result
||
{}).
tip
||
''
;
if
(
tip_text
)
{
tips_dom
.
append
(
'<div class="quizz_tip">'
+
tip_text
+
'</div>'
);
}
}
}
}
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