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
03062df9
Commit
03062df9
authored
Jun 28, 2017
by
Douglas Cerna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial implementation
parent
27e2f4ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
0 deletions
+68
-0
problem_builder/mcq.py
+36
-0
problem_builder/mentoring.py
+32
-0
No files found.
problem_builder/mcq.py
View file @
03062df9
...
@@ -167,6 +167,42 @@ class MCQBlock(SubmittingXBlockMixin, QuestionnaireAbstractBlock):
...
@@ -167,6 +167,42 @@ class MCQBlock(SubmittingXBlockMixin, QuestionnaireAbstractBlock):
self
.
_
(
u"A choice value listed as correct does not exist: {choice}"
)
.
format
(
choice
=
choice_name
(
val
))
self
.
_
(
u"A choice value listed as correct does not exist: {choice}"
)
.
format
(
choice
=
choice_name
(
val
))
)
)
def
student_view_data
(
self
):
"""
Returns a JSON representation of the student_view of this XBlock,
retrievable from the Course Block API.
"""
return
{
'id'
:
self
.
url_name
,
'type'
:
self
.
CATEGORY
,
'question'
:
self
.
question
,
'message'
:
self
.
message
,
'choices'
:
[
{
'value'
:
choice
[
'value'
],
'content'
:
choice
[
'display_name'
]}
for
choice
in
self
.
human_readable_choices
],
'weight'
:
self
.
weight
,
'correct_choices'
:
self
.
correct_choices
,
'tips'
:
[
{
'content'
:
tip
.
content
,
'for_choices'
:
tip
.
values
}
for
tip
in
self
.
get_tips
()
],
'user_state'
:
{
'student_choice'
:
self
.
student_choice
,
},
}
@property
def
url_name
(
self
):
"""
Get the url_name for this block. In Studio/LMS it is provided by a mixin, so we just
defer to super(). In the workbench or any other platform, we use the usage_id.
"""
try
:
return
super
(
MCQBlock
,
self
)
.
url_name
except
AttributeError
:
return
unicode
(
self
.
scope_ids
.
usage_id
)
class
RatingBlock
(
MCQBlock
):
class
RatingBlock
(
MCQBlock
):
"""
"""
...
...
problem_builder/mentoring.py
View file @
03062df9
...
@@ -905,6 +905,38 @@ class MentoringBlock(BaseMentoringBlock, StudioContainerWithNestedXBlocksMixin,
...
@@ -905,6 +905,38 @@ class MentoringBlock(BaseMentoringBlock, StudioContainerWithNestedXBlocksMixin,
"""
"""
return
loader
.
load_scenarios_from_path
(
'templates/xml'
)
return
loader
.
load_scenarios_from_path
(
'templates/xml'
)
def
student_view_data
(
self
):
"""
Returns a JSON representation of the student_view of this XBlock,
retrievable from the Course Block API.
"""
components
=
[]
for
child_id
in
self
.
children
:
block
=
self
.
runtime
.
get_block
(
child_id
)
if
hasattr
(
block
,
'student_view_data'
):
components
.
append
(
block
.
student_view_data
())
return
{
'max_attempts'
:
self
.
max_attempts
,
'user_state'
:
{
'num_attempts'
:
self
.
num_attempts
,
'attempted'
:
self
.
attempted
,
'completed'
:
self
.
completed
,
'student_results'
:
self
.
student_results
,
'step'
:
self
.
step
,
},
'extended_feedback'
:
self
.
extended_feedback
,
'feedback_label'
:
self
.
feedback_label
,
'components'
:
components
,
'messages'
:
{
message_type
:
get_message_label
(
message_type
)
for
message_type
in
(
'completed'
,
'incomplete'
,
'max_attempts_reached'
,
)
}
}
class
MentoringWithExplicitStepsBlock
(
BaseMentoringBlock
,
StudioContainerWithNestedXBlocksMixin
):
class
MentoringWithExplicitStepsBlock
(
BaseMentoringBlock
,
StudioContainerWithNestedXBlocksMixin
):
"""
"""
...
...
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