Fix in models/exercise_spec.rb, repair average_percentage without submission
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user