Fix number of runs
This commit is contained in:
@ -37,6 +37,11 @@ class Exercise < ActiveRecord::Base
|
|||||||
else 0 end
|
else 0 end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def average_number_of_submissions
|
||||||
|
user_count = internal_users.distinct.count + external_users.distinct.count
|
||||||
|
return user_count == 0 ? 0 : submissions.count() / user_count.to_f()
|
||||||
|
end
|
||||||
|
|
||||||
def average_working_time
|
def average_working_time
|
||||||
self.class.connection.execute("""
|
self.class.connection.execute("""
|
||||||
SELECT avg(working_time) as average_time
|
SELECT avg(working_time) as average_time
|
||||||
|
@ -11,5 +11,5 @@ h1 = @execution_environment
|
|||||||
tr
|
tr
|
||||||
td = exercise.title
|
td = exercise.title
|
||||||
td = exercise.average_score
|
td = exercise.average_score
|
||||||
td = exercise.submissions.count()
|
td = exercise.average_number_of_submissions
|
||||||
td = exercise.average_working_time
|
td = exercise.average_working_time
|
||||||
|
Reference in New Issue
Block a user