Add working time delta for each submission

This commit is contained in:
Maximilian Grundke
2016-02-04 11:36:00 +01:00
parent d343e74287
commit 4ebaee8931
3 changed files with 9 additions and 2 deletions

View File

@ -38,14 +38,17 @@ h1 = "#{@exercise} (external user #{@external_user})"
table.table
thead
tr
- ['.time', '.cause', '.score'].each do |title|
- ['.time', '.cause', '.score', '.time_difference'].each do |title|
th.header = t(title)
tbody
- submissions.each do |submission|
- 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}
- submissions.each_with_index do |submission, index|
tr data-id=submission.id
td.clickable = submission.created_at.strftime("%F %T")
td = submission.cause
td = submission.score
td = Time.at(deltas[1..index].inject(:+)).utc.strftime("%H:%M:%S") if index > 0
p = t('.addendum')
- else
p = t('.no_data_available')

View File

@ -264,6 +264,8 @@ de:
time: Zeit
cause: Grund
score: Punktzahl
time_difference: 'Arbeitszeit bis hier*'
addendum: '* Differenzen von mehr als 30 Minuten werden ignoriert.'
external_users:
statistics:
title: Statistiken für Externe Benutzer

View File

@ -264,6 +264,8 @@ en:
time: Time
cause: Cause
score: Score
time_difference: 'Working Time until here*'
addendum: '* Deltas longer than 30 minutes are ignored.'
external_users:
statistics:
title: External User Statistics