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
2a9a65a8
Commit
2a9a65a8
authored
Mar 25, 2014
by
Alan Boudreault
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various fixes
parent
dbf5365b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
15 deletions
+41
-15
README.md
+22
-0
mentoring/light_children.py
+15
-11
mentoring/mrq.py
+2
-2
mentoring/public/js/mentoring.js
+1
-1
mentoring/templates/html/mentoring.html
+1
-1
No files found.
README.md
View file @
2a9a65a8
...
@@ -75,6 +75,28 @@ Second XBlock instance:
...
@@ -75,6 +75,28 @@ Second XBlock instance:
</mentoring>
</mentoring>
```
```
### Self-assessment MRQs
```
xml
<mentoring
url_name=
"mcq_1"
enforce_dependency=
"false"
>
<mrq
name=
"mrq_1_1"
type=
"choices"
max_attempts=
"3"
>
<question>
What do you like in this MRQ?
</question>
<choice
value=
"elegance"
>
Its elegance
</choice>
<choice
value=
"beauty"
>
Its beauty
</choice>
<choice
value=
"gracefulness"
>
Its gracefulness
</choice>
<choice
value=
"bugs"
>
Its bugs
</choice>
<tip
require=
"gracefulness"
>
This MRQ is indeed very graceful
</tip>
<tip
require=
"elegance,beauty"
>
This is something everyone has to like about this MRQ
</tip>
<tip
reject=
"bugs"
>
Nah, there isn't any!
</tip>
<message
type=
"on-submit"
>
Thank you for answering!
</message>
</mrq>
<message
type=
"completed"
>
All is good now...
<html><p>
Congratulations!
</p></html>
</message>
</mentoring>
### Tables
### Tables
```
xml
```
xml
...
...
mentoring/light_children.py
View file @
2a9a65a8
...
@@ -103,14 +103,6 @@ class LightChildrenMixin(XBlockWithChildrenFragmentsMixin):
...
@@ -103,14 +103,6 @@ class LightChildrenMixin(XBlockWithChildrenFragmentsMixin):
child
=
child_class
(
block
)
child
=
child_class
(
block
)
child
.
name
=
u'{}_{}'
.
format
(
block
.
name
,
child_id
)
child
.
name
=
u'{}_{}'
.
format
(
block
.
name
,
child_id
)
# Instanciate our LightChild fields
# TODO HACK, Since we are not replacing the fields attribute with directly, we need to
# instanciate new fields for our LightChild.
fields
=
[(
attr
,
value
)
for
attr
,
value
in
child_class
.
__dict__
.
iteritems
()
if
\
isinstance
(
value
,
LightChildField
)]
for
attr
,
value
in
fields
:
child
.
__dict__
[
attr
]
=
copy
.
deepcopy
(
value
)
# Add any children the child may itself have
# Add any children the child may itself have
child_class
.
init_block_from_node
(
child
,
xml_child
,
xml_child
.
items
())
child_class
.
init_block_from_node
(
child
,
xml_child
,
xml_child
.
items
())
...
@@ -219,6 +211,14 @@ class LightChild(Plugin, LightChildrenMixin):
...
@@ -219,6 +211,14 @@ class LightChild(Plugin, LightChildrenMixin):
self
.
parent
=
parent
self
.
parent
=
parent
self
.
xblock_container
=
parent
.
xblock_container
self
.
xblock_container
=
parent
.
xblock_container
# Instanciate our LightChild fields
# TODO HACK, Since we are not replacing the fields attribute directly, we need to
# instanciate new fields for our LightChild.
fields
=
[(
attr
,
value
)
for
attr
,
value
in
self
.
__class__
.
__dict__
.
iteritems
()
if
\
isinstance
(
value
,
LightChildField
)]
for
attr
,
value
in
fields
:
self
.
__dict__
[
attr
]
=
copy
.
deepcopy
(
value
)
def
__setattr__
(
self
,
name
,
value
):
def
__setattr__
(
self
,
name
,
value
):
field
=
getattr
(
self
,
name
)
if
hasattr
(
self
,
name
)
else
None
field
=
getattr
(
self
,
name
)
if
hasattr
(
self
,
name
)
else
None
...
@@ -262,11 +262,12 @@ class LightChild(Plugin, LightChildrenMixin):
...
@@ -262,11 +262,12 @@ class LightChild(Plugin, LightChildrenMixin):
"""
"""
Load the values from the student_data in the database.
Load the values from the student_data in the database.
"""
"""
if
not
self
.
student_data
:
fields
=
self
.
get_fields_to_save
()
if
not
fields
or
not
self
.
student_data
:
return
return
student_data
=
json
.
loads
(
self
.
student_data
)
student_data
=
json
.
loads
(
self
.
student_data
)
fields
=
self
.
get_fields_to_save
()
for
field
in
fields
:
for
field
in
fields
:
if
field
in
student_data
:
if
field
in
student_data
:
setattr
(
self
,
field
,
student_data
[
field
])
setattr
(
self
,
field
,
student_data
[
field
])
...
@@ -381,7 +382,10 @@ class Integer(LightChildField):
...
@@ -381,7 +382,10 @@ class Integer(LightChildField):
return
self
.
value
is
not
None
return
self
.
value
is
not
None
def
set
(
self
,
value
):
def
set
(
self
,
value
):
self
.
value
=
int
(
value
)
try
:
self
.
value
=
int
(
value
)
except
(
TypeError
,
ValueError
):
# not an integer
self
.
value
=
None
def
from_json
(
self
,
value
):
def
from_json
(
self
,
value
):
if
value
is
None
or
value
==
''
:
if
value
is
None
or
value
==
''
:
...
...
mentoring/mrq.py
View file @
2a9a65a8
...
@@ -103,8 +103,8 @@ class MRQBlock(QuestionnaireAbstractBlock):
...
@@ -103,8 +103,8 @@ class MRQBlock(QuestionnaireAbstractBlock):
completed
=
True
completed
=
True
self
.
message
=
self
.
message
.
get
()
+
u' You have reached the maximum number of attempts for this question. '
\
self
.
message
=
self
.
message
.
get
()
+
u' You have reached the maximum number of attempts for this question. '
\
u'Your next answers won''t be saved. You can check the answer(s) using the "Show Answer(s)" button.'
u'Your next answers won''t be saved. You can check the answer(s) using the "Show Answer(s)" button.'
else
:
self
.
student_choices
=
submissions
self
.
student_choices
=
submissions
result
=
{
result
=
{
'submissions'
:
submissions
,
'submissions'
:
submissions
,
...
...
mentoring/public/js/mentoring.js
View file @
2a9a65a8
...
@@ -74,7 +74,7 @@ function MentoringBlock(runtime, element) {
...
@@ -74,7 +74,7 @@ function MentoringBlock(runtime, element) {
}
}
function
initXBlock
()
{
function
initXBlock
()
{
var
submit_dom
=
$
(
element
).
find
(
'.submit
input
'
);
var
submit_dom
=
$
(
element
).
find
(
'.submit
.input-main
'
);
submit_dom
.
bind
(
'click'
,
function
()
{
submit_dom
.
bind
(
'click'
,
function
()
{
var
data
=
{};
var
data
=
{};
...
...
mentoring/templates/html/mentoring.html
View file @
2a9a65a8
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
{% endfor %}
{% endfor %}
{% if self.display_submit %}
{% if self.display_submit %}
<div
class=
"submit"
>
<div
class=
"submit"
>
<input
type=
"button"
value=
"Submit"
></input>
<input
type=
"button"
class=
"input-main"
value=
"Submit"
></input>
<span
class=
"progress"
data-completed=
"{{ self.completed }}"
data-attempted=
"{{ self.attempted }}"
>
<span
class=
"progress"
data-completed=
"{{ self.completed }}"
data-attempted=
"{{ self.attempted }}"
>
<span
class=
'indicator'
></span>
<span
class=
'indicator'
></span>
</span>
</span>
...
...
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