Commit 0d915cc4 by dragonfi

pep8

parent bcf736a6
......@@ -29,6 +29,7 @@ from .light_children import LightChild, Scope, String
log = logging.getLogger(__name__)
class SharedHeaderBlock(LightChild):
"""
A shared header block shown under the title.
......
......@@ -108,12 +108,11 @@ class MentoringBlock(XBlockWithLightChildren):
total_child_weight = sum(float(step.weight) for step in self.steps)
if total_child_weight == 0:
return (0, 0, 0, 0)
score = sum(r[1]['score']*r[1]['weight'] \
for r in self.student_results) / total_child_weight
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'] == False)
score = sum(r[1]['score'] * r[1]['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)
incorrect = sum(1 for r in self.student_results if r[1]['completed'] is False)
return (score, int(round(score*100)), correct, incorrect)
return (score, int(round(score * 100)), correct, incorrect)
def _index_steps(self):
steps = self.steps
......@@ -127,7 +126,6 @@ class MentoringBlock(XBlockWithLightChildren):
child.index = index
index += 1
def student_view(self, context):
self._index_steps()
......@@ -136,7 +134,6 @@ class MentoringBlock(XBlockWithLightChildren):
not_instance_of=self.FLOATING_BLOCKS,
)
fragment.add_content(render_template('templates/html/mentoring.html', {
'self': self,
'named_children': named_children,
......@@ -144,7 +141,7 @@ class MentoringBlock(XBlockWithLightChildren):
}))
fragment.add_css_url(self.runtime.local_resource_url(self, 'public/css/mentoring.css'))
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:
fragment.add_javascript_url(
self.runtime.local_resource_url(self, 'public/js/mentoring_assessment_view.js')
......@@ -176,7 +173,7 @@ class MentoringBlock(XBlockWithLightChildren):
data['component_id'] = self.url_name
self.runtime.publish(self, event_type, data)
return {'result':'success'}
return {'result': 'success'}
@property
def title(self):
......@@ -248,8 +245,7 @@ class MentoringBlock(XBlockWithLightChildren):
if self.has_missing_dependency:
completed = False
message = 'You need to complete all previous steps before being able to complete '+\
'the current one.'
message = 'You need to complete all previous steps before being able to complete the current one.'
elif completed and self.next_step == self.url_name:
self.next_step = self.followed_by
......@@ -293,7 +289,7 @@ class MentoringBlock(XBlockWithLightChildren):
completed = False
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)]
for child in children:
......@@ -309,7 +305,7 @@ class MentoringBlock(XBlockWithLightChildren):
completed = False
break
self.step = step+1
self.step = step + 1
child_result = child.submit(submission)
if 'tips' in child_result:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment