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
77c94472
Commit
77c94472
authored
Mar 02, 2015
by
Braden MacDonald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! Generate any required IDs automatically in Studio
parent
3385ce31
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
mentoring/components/mrq.py
+9
-3
No files found.
mentoring/components/mrq.py
View file @
77c94472
...
@@ -133,6 +133,12 @@ class MRQBlock(QuestionnaireAbstractBlock):
...
@@ -133,6 +133,12 @@ class MRQBlock(QuestionnaireAbstractBlock):
def
add_error
(
msg
):
def
add_error
(
msg
):
validation
.
add
(
ValidationMessage
(
ValidationMessage
.
ERROR
,
msg
))
validation
.
add
(
ValidationMessage
(
ValidationMessage
.
ERROR
,
msg
))
def
choice_name
(
choice_value
):
for
choice
in
self
.
human_readable_choices
:
if
choice
[
"value"
]
==
choice_value
:
return
choice
[
"display_name"
]
return
choice_value
all_values
=
set
(
self
.
all_choice_values
)
all_values
=
set
(
self
.
all_choice_values
)
required
=
set
(
data
.
required_choices
)
required
=
set
(
data
.
required_choices
)
ignored
=
set
(
data
.
ignored_choices
)
ignored
=
set
(
data
.
ignored_choices
)
...
@@ -142,8 +148,8 @@ class MRQBlock(QuestionnaireAbstractBlock):
...
@@ -142,8 +148,8 @@ class MRQBlock(QuestionnaireAbstractBlock):
if
len
(
ignored
)
<
len
(
data
.
ignored_choices
):
if
len
(
ignored
)
<
len
(
data
.
ignored_choices
):
add_error
(
u"Duplicate ignored choices set"
)
add_error
(
u"Duplicate ignored choices set"
)
for
val
in
required
.
intersection
(
ignored
):
for
val
in
required
.
intersection
(
ignored
):
add_error
(
u"A choice is listed as both required and ignored: {}"
.
format
(
val
))
add_error
(
u"A choice is listed as both required and ignored: {}"
.
format
(
choice_name
(
val
)
))
for
val
in
(
required
-
all_values
):
for
val
in
(
required
-
all_values
):
add_error
(
u"A choice value listed as required does not exist: {}"
.
format
(
val
))
add_error
(
u"A choice value listed as required does not exist: {}"
.
format
(
choice_name
(
val
)
))
for
val
in
(
ignored
-
all_values
):
for
val
in
(
ignored
-
all_values
):
add_error
(
u"A choice value listed as ignored does not exist: {}"
.
format
(
val
))
add_error
(
u"A choice value listed as ignored does not exist: {}"
.
format
(
choice_name
(
val
)
))
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