Commit e933d41b by Sven Marnach Committed by GitHub

Merge pull request #2 from UmanShahzad/uman/OC-2642

Fix [EDUCATOR-338]: Errors: "'float' object is not callable"
parents 1786a2c8 e05e35b0
...@@ -74,7 +74,7 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock): ...@@ -74,7 +74,7 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock):
scope=Scope.content, scope=Scope.content,
default=1.0, default=1.0,
) )
max_score = Float( maximum_score = Float(
display_name='Maximum score', display_name='Maximum score',
help='The number of points students will be awarded when solving all fields correctly. ' help='The number of points students will be awarded when solving all fields correctly. '
'For partially correct attempts, the score will be pro-rated.', 'For partially correct attempts, the score will be pro-rated.',
...@@ -95,7 +95,7 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock): ...@@ -95,7 +95,7 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock):
'column_widths', 'column_widths',
'row_heights', 'row_heights',
'default_tolerance', 'default_tolerance',
'max_score', 'maximum_score',
'max_attempts', 'max_attempts',
] ]
...@@ -171,7 +171,7 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock): ...@@ -171,7 +171,7 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock):
num_correct_answers=self.num_correct_answers, num_correct_answers=self.num_correct_answers,
num_total_answers=self.num_total_answers, num_total_answers=self.num_total_answers,
score=self.score, score=self.score,
max_score=self.max_score, maximum_score=self.maximum_score,
attempts=self.attempts, attempts=self.attempts,
max_attempts=self.max_attempts, max_attempts=self.max_attempts,
) )
...@@ -231,8 +231,8 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock): ...@@ -231,8 +231,8 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock):
""" """
self.answers_correct = self.check_and_save_answers(data) self.answers_correct = self.check_and_save_answers(data)
self.attempts += 1 self.attempts += 1
self.score = self.num_correct_answers * self.max_score / len(self.answers_correct) self.score = self.num_correct_answers * self.maximum_score / len(self.answers_correct)
self.runtime.publish(self, 'grade', dict(value=self.score, max_value=self.max_score)) self.runtime.publish(self, 'grade', dict(value=self.score, max_value=self.maximum_score))
return self.get_status() return self.get_status()
@XBlock.json_handler @XBlock.json_handler
......
...@@ -47,9 +47,9 @@ function ActiveTableXBlock(runtime, element, init_args) { ...@@ -47,9 +47,9 @@ function ActiveTableXBlock(runtime, element, init_args) {
function updateFeedback(data) { function updateFeedback(data) {
var feedback_msg; var feedback_msg;
if (data.score === null) { if (data.score === null) {
feedback_msg = '(' + data.max_score + ' points possible)'; feedback_msg = '(' + data.maximum_score + ' points possible)';
} else { } else {
feedback_msg = '(' + data.score + '/' + data.max_score + ' points)'; feedback_msg = '(' + data.score + '/' + data.maximum_score + ' points)';
} }
if (data.max_attempts) { if (data.max_attempts) {
feedback_msg = 'You have used ' + data.attempts + ' of ' + data.max_attempts + feedback_msg = 'You have used ' + data.attempts + ' of ' + data.max_attempts +
......
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