Fix in models/exercise_spec.rb, repair average_percentage without submission

This commit is contained in:
yqbk
2016-05-25 14:39:48 +02:00
parent 5f721e6a6b
commit b5c3d8170d
6 changed files with 13 additions and 4 deletions

View File

@ -30,7 +30,7 @@ class Exercise < ActiveRecord::Base
def average_percentage
if average_score and maximum_score != 0.0
if average_score and maximum_score != 0.0 and submissions.exists?(cause: 'submit')
(average_score / maximum_score * 100).round
else
0