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
bcf736a6
Commit
bcf736a6
authored
Sep 09, 2014
by
dragonfi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor: Reduce repetition with FLOATING_BLOCKS constant
parent
9d0e771a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
mentoring/mentoring.py
+5
-3
No files found.
mentoring/mentoring.py
View file @
bcf736a6
...
@@ -91,6 +91,8 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -91,6 +91,8 @@ class MentoringBlock(XBlockWithLightChildren):
MENTORING_MODES
=
(
'standard'
,
'assessment'
)
MENTORING_MODES
=
(
'standard'
,
'assessment'
)
FLOATING_BLOCKS
=
(
TitleBlock
,
MentoringMessageBlock
,
SharedHeaderBlock
)
@property
@property
def
is_assessment
(
self
):
def
is_assessment
(
self
):
return
self
.
mode
==
'assessment'
return
self
.
mode
==
'assessment'
...
@@ -98,7 +100,7 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -98,7 +100,7 @@ class MentoringBlock(XBlockWithLightChildren):
@property
@property
def
steps
(
self
):
def
steps
(
self
):
return
[
child
for
child
in
self
.
get_children_objects
()
if
return
[
child
for
child
in
self
.
get_children_objects
()
if
not
isinstance
(
child
,
(
HTMLBlock
,
TitleBlock
,
MentoringMessageBlock
,
SharedHeaderBlock
))]
not
isinstance
(
child
,
self
.
FLOATING_BLOCKS
+
(
HTMLBlock
,
))]
@property
@property
def
score
(
self
):
def
score
(
self
):
...
@@ -131,7 +133,7 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -131,7 +133,7 @@ class MentoringBlock(XBlockWithLightChildren):
fragment
,
named_children
=
self
.
get_children_fragment
(
fragment
,
named_children
=
self
.
get_children_fragment
(
context
,
view_name
=
'mentoring_view'
,
context
,
view_name
=
'mentoring_view'
,
not_instance_of
=
(
MentoringMessageBlock
,
TitleBlock
,
SharedHeaderBlock
)
not_instance_of
=
self
.
FLOATING_BLOCKS
,
)
)
...
@@ -292,7 +294,7 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -292,7 +294,7 @@ class MentoringBlock(XBlockWithLightChildren):
completed
=
False
completed
=
False
current_child
=
None
current_child
=
None
children
=
[
child
for
child
in
self
.
get_children_objects
()
\
children
=
[
child
for
child
in
self
.
get_children_objects
()
\
if
not
isinstance
(
child
,
(
TitleBlock
,
SharedHeaderBlock
)
)]
if
not
isinstance
(
child
,
self
.
FLOATING_BLOCKS
)]
for
child
in
children
:
for
child
in
children
:
if
child
.
name
and
child
.
name
in
submissions
:
if
child
.
name
and
child
.
name
in
submissions
:
...
...
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