handle 0 max score
This commit is contained in:
@ -38,7 +38,11 @@ class Submission < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def normalized_score
|
def normalized_score
|
||||||
score / exercise.maximum_score if score
|
if score && exercise.maximum_score && exercise.maximum_score > 0
|
||||||
|
score / exercise.maximum_score
|
||||||
|
else
|
||||||
|
0
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
def percentage
|
def percentage
|
||||||
|
Reference in New Issue
Block a user