Add execution environment statistics

This commit is contained in:
Maximilian Grundke
2015-10-29 14:19:31 +01:00
parent 22da25be60
commit 78422647fe
9 changed files with 53 additions and 10 deletions

View File

@@ -9,7 +9,7 @@ h1 = ExecutionEnvironment.model_name.human(count: 2)
th = t('activerecord.attributes.execution_environment.memory_limit')
th = t('activerecord.attributes.execution_environment.network_enabled')
th = t('activerecord.attributes.execution_environment.permitted_execution_time')
th colspan=4 = t('shared.actions')
th colspan=5 = t('shared.actions')
th colspan=2 = t('shared.resources')
tbody
- @execution_environments.each do |execution_environment|
@@ -23,6 +23,7 @@ h1 = ExecutionEnvironment.model_name.human(count: 2)
td = link_to(t('shared.edit'), edit_execution_environment_path(execution_environment))
td = link_to(t('shared.destroy'), execution_environment, data: {confirm: t('shared.confirm_destroy')}, method: :delete)
td = link_to(t('.shell'), shell_execution_environment_path(execution_environment))
td = link_to(t('shared.statistics'), statistics_execution_environment_path(execution_environment))
td = link_to(t('activerecord.models.error.other'), execution_environment_errors_path(execution_environment.id))
td = link_to(t('activerecord.models.hint.other'), execution_environment_hints_path(execution_environment.id))

View File

@@ -0,0 +1,23 @@
h1 = @execution_environment
.table-responsive
table.table
thead
tr
- ['.exercise', '.score', '.runs', '.worktime'].each do |title|
th.header = t(title)
tbody
- @execution_environment.exercises.each do |exercise|
tr
- submissions = exercise.submissions
td = exercise.title
td = submissions.average(:score)
td = submissions.count()
- minima = submissions.group(:user_id).minimum(:created_at)
- maxima = submissions.group(:user_id).maximum(:created_at)
- result = 0
- results = {}
- maxima.each {|key, value| results[key] = value - minima[key]}
- results.values.map {|value| result += value}
- result /= results.size if results.size > 0
td = distance_of_time_in_words(result)