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
cf241b6b
Commit
cf241b6b
authored
Mar 17, 2015
by
Braden MacDonald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address some of nedbat's comments
parent
363a5192
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
11 deletions
+13
-11
mentoring/mcq.py
+1
-0
mentoring/mentoring.py
+10
-10
mentoring/questionnaire.py
+2
-1
No files found.
mentoring/mcq.py
View file @
cf241b6b
...
@@ -65,6 +65,7 @@ class MCQBlock(QuestionnaireAbstractBlock):
...
@@ -65,6 +65,7 @@ class MCQBlock(QuestionnaireAbstractBlock):
def
describe_choice_correctness
(
self
,
choice_value
):
def
describe_choice_correctness
(
self
,
choice_value
):
if
choice_value
in
self
.
correct_choices
:
if
choice_value
in
self
.
correct_choices
:
if
len
(
self
.
correct_choices
)
==
1
:
if
len
(
self
.
correct_choices
)
==
1
:
# Translators: This is an adjective, describing a choice as correct
return
self
.
_
(
u"Correct"
)
return
self
.
_
(
u"Correct"
)
return
self
.
_
(
u"Acceptable"
)
return
self
.
_
(
u"Acceptable"
)
else
:
else
:
...
...
mentoring/mentoring.py
View file @
cf241b6b
...
@@ -36,6 +36,12 @@ from .step import StepParentMixin, StepMixin
...
@@ -36,6 +36,12 @@ from .step import StepParentMixin, StepMixin
from
xblockutils.resources
import
ResourceLoader
from
xblockutils.resources
import
ResourceLoader
from
xblockutils.studio_editable
import
StudioEditableXBlockMixin
,
StudioContainerXBlockMixin
from
xblockutils.studio_editable
import
StudioEditableXBlockMixin
,
StudioContainerXBlockMixin
try
:
# Used to detect if we're in the workbench so we can add Font Awesome
from
workbench.runtime
import
WorkbenchRuntime
except
ImportError
:
WorkbenchRuntime
=
False
# Globals ###########################################################
# Globals ###########################################################
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
@@ -224,9 +230,7 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC
...
@@ -224,9 +230,7 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC
for
child_id
in
self
.
children
:
for
child_id
in
self
.
children
:
child
=
self
.
runtime
.
get_block
(
child_id
)
child
=
self
.
runtime
.
get_block
(
child_id
)
if
isinstance
(
child
,
MentoringMessageBlock
):
if
not
isinstance
(
child
,
MentoringMessageBlock
):
pass
else
:
try
:
try
:
if
self
.
is_assessment
and
isinstance
(
child
,
StepMixin
):
if
self
.
is_assessment
and
isinstance
(
child
,
StepMixin
):
child_fragment
=
child
.
render
(
'assessment_step_view'
,
context
)
child_fragment
=
child
.
render
(
'assessment_step_view'
,
context
)
...
@@ -258,12 +262,8 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC
...
@@ -258,12 +262,8 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC
self
.
include_theme_files
(
fragment
)
self
.
include_theme_files
(
fragment
)
# Workbench doesn't have font awesome, so add it:
# Workbench doesn't have font awesome, so add it:
try
:
if
WorkbenchRuntime
and
isinstance
(
self
.
runtime
,
WorkbenchRuntime
):
from
workbench.runtime
import
WorkbenchRuntime
fragment
.
add_css_url
(
'//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css'
)
if
isinstance
(
self
.
runtime
,
WorkbenchRuntime
):
fragment
.
add_css_url
(
'//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css'
)
except
ImportError
:
pass
fragment
.
initialize_js
(
'MentoringBlock'
)
fragment
.
initialize_js
(
'MentoringBlock'
)
...
@@ -533,7 +533,7 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC
...
@@ -533,7 +533,7 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC
if
msg_type
in
message_types_present
:
if
msg_type
in
message_types_present
:
validation
.
add
(
ValidationMessage
(
validation
.
add
(
ValidationMessage
(
ValidationMessage
.
ERROR
,
ValidationMessage
.
ERROR
,
self
.
_
(
u"There should only be one '{
}' message component."
.
format
(
msg_type
)
)
self
.
_
(
u"There should only be one '{
msg_type}' message component."
)
.
format
(
msg_type
=
msg_type
)
))
))
message_types_present
.
add
(
msg_type
)
message_types_present
.
add
(
msg_type
)
if
a_child_has_issues
:
if
a_child_has_issues
:
...
...
mentoring/questionnaire.py
View file @
cf241b6b
...
@@ -246,7 +246,8 @@ class QuestionnaireAbstractBlock(StudioEditableXBlockMixin, StudioContainerXBloc
...
@@ -246,7 +246,8 @@ class QuestionnaireAbstractBlock(StudioEditableXBlockMixin, StudioContainerXBloc
values_with_tips
=
set
()
values_with_tips
=
set
()
for
tip
in
self
.
get_tips
():
for
tip
in
self
.
get_tips
():
values
=
set
(
tip
.
values
)
values
=
set
(
tip
.
values
)
for
dummy
in
(
values
&
values_with_tips
)
:
if
values
&
values_with_tips
:
add_error
(
self
.
_
(
u"Multiple tips configured for the same choice."
))
add_error
(
self
.
_
(
u"Multiple tips configured for the same choice."
))
break
values_with_tips
.
update
(
values
)
values_with_tips
.
update
(
values
)
return
validation
return
validation
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