Show testrun results in statistics

This commit is contained in:
Maximilian Grundke
2016-03-09 15:20:38 +01:00
parent 087b2bdf93
commit 16346fa732
5 changed files with 7 additions and 1 deletions

View File

@ -21,6 +21,7 @@ module CodeOcean
belongs_to :file_type belongs_to :file_type
has_many :files has_many :files
has_many :testruns
alias_method :descendants, :files alias_method :descendants, :files
mount_uploader :native_file, FileUploader mount_uploader :native_file, FileUploader

View File

@ -7,6 +7,8 @@ class Submission < ActiveRecord::Base
belongs_to :exercise belongs_to :exercise
has_many :testruns
delegate :execution_environment, to: :exercise delegate :execution_environment, to: :exercise
scope :final, -> { where(cause: 'submit') } scope :final, -> { where(cause: 'submit') }

View File

@ -38,7 +38,7 @@ h1 = "#{@exercise} (external user #{@external_user})"
table.table table.table
thead thead
tr tr
- ['.time', '.cause', '.score', '.time_difference'].each do |title| - ['.time', '.cause', '.score', '.tests', '.time_difference'].each do |title|
th.header = t(title) th.header = t(title)
tbody tbody
- deltas = submissions.map.with_index {|item, index| delta = item.created_at - submissions[index - 1].created_at if index > 0; if delta == nil or delta > 30*60 then 0 else delta end} - deltas = submissions.map.with_index {|item, index| delta = item.created_at - submissions[index - 1].created_at if index > 0; if delta == nil or delta > 30*60 then 0 else delta end}
@ -47,6 +47,7 @@ h1 = "#{@exercise} (external user #{@external_user})"
td.clickable = submission.created_at.strftime("%F %T") td.clickable = submission.created_at.strftime("%F %T")
td = submission.cause td = submission.cause
td = submission.score td = submission.score
td = submission.testruns.map{|run| run.passed ? 'p' : 'f'}.join(' ')
td = Time.at(deltas[1..index].inject(:+)).utc.strftime("%H:%M:%S") if index > 0 td = Time.at(deltas[1..index].inject(:+)).utc.strftime("%H:%M:%S") if index > 0
p = t('.addendum') p = t('.addendum')

View File

@ -269,6 +269,7 @@ de:
time: Zeit time: Zeit
cause: Grund cause: Grund
score: Punktzahl score: Punktzahl
tests: Unit Tests
time_difference: 'Arbeitszeit bis hier*' time_difference: 'Arbeitszeit bis hier*'
addendum: '* Differenzen von mehr als 30 Minuten werden ignoriert.' addendum: '* Differenzen von mehr als 30 Minuten werden ignoriert.'
external_users: external_users:

View File

@ -269,6 +269,7 @@ en:
time: Time time: Time
cause: Cause cause: Cause
score: Score score: Score
tests: Unit Test Results
time_difference: 'Working Time until here*' time_difference: 'Working Time until here*'
addendum: '* Deltas longer than 30 minutes are ignored.' addendum: '* Deltas longer than 30 minutes are ignored.'
external_users: external_users: