From e47e60f68b0146a9922d92547c8df18343ef6a15 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Sat, 16 Nov 2013 10:30:05 -0500 Subject: [PATCH] Assign a score of 0 to tasks with no attempts --- .../combined_open_ended_modulev1.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py index 8e8d33ad08..5c0a3b16ff 100644 --- a/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py +++ b/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py @@ -259,7 +259,11 @@ class CombinedOpenEndedV1Module(): return (0, 0, state_values[self.INITITIAL], idx) final_child_state = json.loads(task_states[-1]) - best_score = max(attempt.get('score', 0) for attempt in final_child_state.get('child_history', [])) + scores = [attempt.get('score', 0) for attempt in final_child_state.get('child_history', [])] + if scores: + best_score = max(scores) + else: + best_score = 0 return ( len(task_states), best_score,