Commit 247ccc37 by Vik Paruchuri

Code reformat, patch score gen

parent 112fb453
...@@ -740,14 +740,18 @@ class CombinedOpenEndedV1Module(): ...@@ -740,14 +740,18 @@ class CombinedOpenEndedV1Module():
scores = [] scores = []
for i in xrange(0,self.current_task_number): for i in xrange(0,self.current_task_number):
last_response = self.get_last_response(i) last_response = self.get_last_response(i)
max_score = last_response['max_score'] * float(self.weight) try:
score = last_response['score'] * float(self.weight) max_score = last_response['max_score'] * float(self.weight)
scores.append(score) score = last_response['score'] * float(self.weight)
score = max(scores) scores.append(score)
except:
pass
if len(scores)>0:
score = max(scores)
score_dict = { score_dict = {
'score': score , 'score': score,
'total': max_score , 'total': max_score,
} }
return score_dict return score_dict
......
...@@ -183,12 +183,10 @@ class PeerGradingModule(PeerGradingFields, XModule): ...@@ -183,12 +183,10 @@ class PeerGradingModule(PeerGradingFields, XModule):
score_dict = { score_dict = {
'score': score, 'score': score,
'total': max_score, 'total': max_score,
} }
if self.use_for_single_location not in TRUE_DICT or self.is_graded not in TRUE_DICT: if self.use_for_single_location not in TRUE_DICT or self.is_graded not in TRUE_DICT:
return score_dict return score_dict
try: try:
count_graded = self.student_data_for_location['count_graded'] count_graded = self.student_data_for_location['count_graded']
count_required = self.student_data_for_location['count_required'] count_required = self.student_data_for_location['count_required']
...@@ -207,7 +205,7 @@ class PeerGradingModule(PeerGradingFields, XModule): ...@@ -207,7 +205,7 @@ class PeerGradingModule(PeerGradingFields, XModule):
self.student_data_for_location = response self.student_data_for_location = response
try: try:
score = int(count_graded >= count_required and count_graded>0) * float(self.weight) score = int(count_graded >= count_required and count_graded > 0) * float(self.weight)
total = self.max_grade * float(self.weight) total = self.max_grade * float(self.weight)
score_dict['score'] = score score_dict['score'] = score
score_dict['total'] = total score_dict['total'] = total
...@@ -588,5 +586,5 @@ class PeerGradingDescriptor(PeerGradingFields, RawDescriptor): ...@@ -588,5 +586,5 @@ class PeerGradingDescriptor(PeerGradingFields, RawDescriptor):
stores_state = True stores_state = True
has_score = True has_score = True
always_recalculate_grades=True always_recalculate_grades = True
template_dir_name = "peer_grading" template_dir_name = "peer_grading"
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