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
0d915cc4
Commit
0d915cc4
authored
Sep 09, 2014
by
dragonfi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pep8
parent
bcf736a6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
13 deletions
+10
-13
mentoring/header.py
+1
-0
mentoring/mentoring.py
+9
-13
No files found.
mentoring/header.py
View file @
0d915cc4
...
@@ -29,6 +29,7 @@ from .light_children import LightChild, Scope, String
...
@@ -29,6 +29,7 @@ from .light_children import LightChild, Scope, String
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
class
SharedHeaderBlock
(
LightChild
):
class
SharedHeaderBlock
(
LightChild
):
"""
"""
A shared header block shown under the title.
A shared header block shown under the title.
...
...
mentoring/mentoring.py
View file @
0d915cc4
...
@@ -108,12 +108,11 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -108,12 +108,11 @@ class MentoringBlock(XBlockWithLightChildren):
total_child_weight
=
sum
(
float
(
step
.
weight
)
for
step
in
self
.
steps
)
total_child_weight
=
sum
(
float
(
step
.
weight
)
for
step
in
self
.
steps
)
if
total_child_weight
==
0
:
if
total_child_weight
==
0
:
return
(
0
,
0
,
0
,
0
)
return
(
0
,
0
,
0
,
0
)
score
=
sum
(
r
[
1
][
'score'
]
*
r
[
1
][
'weight'
]
\
score
=
sum
(
r
[
1
][
'score'
]
*
r
[
1
][
'weight'
]
for
r
in
self
.
student_results
)
/
total_child_weight
for
r
in
self
.
student_results
)
/
total_child_weight
correct
=
sum
(
1
for
r
in
self
.
student_results
if
r
[
1
][
'completed'
]
is
True
)
correct
=
sum
(
1
for
r
in
self
.
student_results
if
r
[
1
][
'completed'
]
==
True
)
incorrect
=
sum
(
1
for
r
in
self
.
student_results
if
r
[
1
][
'completed'
]
is
False
)
incorrect
=
sum
(
1
for
r
in
self
.
student_results
if
r
[
1
][
'completed'
]
==
False
)
return
(
score
,
int
(
round
(
score
*
100
)),
correct
,
incorrect
)
return
(
score
,
int
(
round
(
score
*
100
)),
correct
,
incorrect
)
def
_index_steps
(
self
):
def
_index_steps
(
self
):
steps
=
self
.
steps
steps
=
self
.
steps
...
@@ -127,7 +126,6 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -127,7 +126,6 @@ class MentoringBlock(XBlockWithLightChildren):
child
.
index
=
index
child
.
index
=
index
index
+=
1
index
+=
1
def
student_view
(
self
,
context
):
def
student_view
(
self
,
context
):
self
.
_index_steps
()
self
.
_index_steps
()
...
@@ -136,7 +134,6 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -136,7 +134,6 @@ class MentoringBlock(XBlockWithLightChildren):
not_instance_of
=
self
.
FLOATING_BLOCKS
,
not_instance_of
=
self
.
FLOATING_BLOCKS
,
)
)
fragment
.
add_content
(
render_template
(
'templates/html/mentoring.html'
,
{
fragment
.
add_content
(
render_template
(
'templates/html/mentoring.html'
,
{
'self'
:
self
,
'self'
:
self
,
'named_children'
:
named_children
,
'named_children'
:
named_children
,
...
@@ -144,7 +141,7 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -144,7 +141,7 @@ class MentoringBlock(XBlockWithLightChildren):
}))
}))
fragment
.
add_css_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/css/mentoring.css'
))
fragment
.
add_css_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/css/mentoring.css'
))
fragment
.
add_javascript_url
(
fragment
.
add_javascript_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/js/vendor/underscore-min.js'
))
self
.
runtime
.
local_resource_url
(
self
,
'public/js/vendor/underscore-min.js'
))
if
self
.
is_assessment
:
if
self
.
is_assessment
:
fragment
.
add_javascript_url
(
fragment
.
add_javascript_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/js/mentoring_assessment_view.js'
)
self
.
runtime
.
local_resource_url
(
self
,
'public/js/mentoring_assessment_view.js'
)
...
@@ -176,7 +173,7 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -176,7 +173,7 @@ class MentoringBlock(XBlockWithLightChildren):
data
[
'component_id'
]
=
self
.
url_name
data
[
'component_id'
]
=
self
.
url_name
self
.
runtime
.
publish
(
self
,
event_type
,
data
)
self
.
runtime
.
publish
(
self
,
event_type
,
data
)
return
{
'result'
:
'success'
}
return
{
'result'
:
'success'
}
@property
@property
def
title
(
self
):
def
title
(
self
):
...
@@ -248,8 +245,7 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -248,8 +245,7 @@ class MentoringBlock(XBlockWithLightChildren):
if
self
.
has_missing_dependency
:
if
self
.
has_missing_dependency
:
completed
=
False
completed
=
False
message
=
'You need to complete all previous steps before being able to complete '
+
\
message
=
'You need to complete all previous steps before being able to complete the current one.'
'the current one.'
elif
completed
and
self
.
next_step
==
self
.
url_name
:
elif
completed
and
self
.
next_step
==
self
.
url_name
:
self
.
next_step
=
self
.
followed_by
self
.
next_step
=
self
.
followed_by
...
@@ -293,7 +289,7 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -293,7 +289,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
,
self
.
FLOATING_BLOCKS
)]
if
not
isinstance
(
child
,
self
.
FLOATING_BLOCKS
)]
for
child
in
children
:
for
child
in
children
:
...
@@ -309,7 +305,7 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -309,7 +305,7 @@ class MentoringBlock(XBlockWithLightChildren):
completed
=
False
completed
=
False
break
break
self
.
step
=
step
+
1
self
.
step
=
step
+
1
child_result
=
child
.
submit
(
submission
)
child_result
=
child
.
submit
(
submission
)
if
'tips'
in
child_result
:
if
'tips'
in
child_result
:
...
...
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