Highlight gaps in exercise working time
This commit is contained in:
@ -58,6 +58,10 @@ div.negative-result {
|
|||||||
box-shadow: 0px 0px 11px 1px rgba(222,0,0,1);
|
box-shadow: 0px 0px 11px 1px rgba(222,0,0,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr.highlight {
|
||||||
|
border-top: 2px solid rgba(222,0,0,1);
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// StatisticsController:
|
// StatisticsController:
|
||||||
|
|
||||||
|
@ -326,6 +326,16 @@ class ExercisesController < ApplicationController
|
|||||||
|
|
||||||
def statistics
|
def statistics
|
||||||
if(@external_user)
|
if(@external_user)
|
||||||
|
@submissions = Submission.where("user_id = ? AND exercise_id = ?", @external_user.id, @exercise.id).order("created_at")
|
||||||
|
@submissions_and_interventions = (@submissions + UserExerciseIntervention.where("user_id = ? AND exercise_id = ?", @external_user.id, @exercise.id)).sort_by { |a| a.created_at }
|
||||||
|
deltas = @submissions.map.with_index do |item, index|
|
||||||
|
delta = item.created_at - @submissions[index - 1].created_at if index > 0
|
||||||
|
if delta == nil or delta > 10 * 60 then 0 else delta end
|
||||||
|
end
|
||||||
|
@working_times_until = []
|
||||||
|
@submissions_and_interventions.each_with_index do |submission, index|
|
||||||
|
@working_times_until.push((Time.at(deltas[1..index].inject(:+)).utc.strftime("%H:%M:%S") if index > 0))
|
||||||
|
end
|
||||||
render 'exercises/external_users/statistics'
|
render 'exercises/external_users/statistics'
|
||||||
else
|
else
|
||||||
user_statistics = {}
|
user_statistics = {}
|
||||||
|
@ -1,19 +1,16 @@
|
|||||||
h1 = "#{@exercise} (external user #{@external_user})"
|
h1 = "#{@exercise} (external user #{@external_user})"
|
||||||
- submissions = Submission.where("user_id = ? AND exercise_id = ?", @external_user.id, @exercise.id).order("created_at")
|
- current_submission = @submissions.first
|
||||||
- current_submission = submissions.first
|
|
||||||
- submissions_and_interventions = (submissions + UserExerciseIntervention.where("user_id = ? AND exercise_id = ?", @external_user.id, @exercise.id)).sort_by { |a| a.created_at }
|
|
||||||
|
|
||||||
- if current_submission
|
- if current_submission
|
||||||
- initial_files = current_submission.files.to_a
|
- initial_files = current_submission.files.to_a
|
||||||
|
|
||||||
- all_files = []
|
- all_files = []
|
||||||
- file_types = Set.new()
|
- file_types = Set.new()
|
||||||
- submissions.each do |submission|
|
- @submissions.each do |submission|
|
||||||
- submission.files.each do |file|
|
- submission.files.each do |file|
|
||||||
- file_types.add(ActiveSupport::JSON.encode(file.file_type))
|
- file_types.add(ActiveSupport::JSON.encode(file.file_type))
|
||||||
- all_files.push(submission.files)
|
- all_files.push(submission.files)
|
||||||
|
|
||||||
.hidden#data data-submissions=ActiveSupport::JSON.encode(submissions) data-files=ActiveSupport::JSON.encode(all_files) data-file-types=ActiveSupport::JSON.encode(file_types)
|
.hidden#data data-submissions=ActiveSupport::JSON.encode(@submissions) data-files=ActiveSupport::JSON.encode(all_files) data-file-types=ActiveSupport::JSON.encode(file_types)
|
||||||
|
|
||||||
#stats-editor.row
|
#stats-editor.row
|
||||||
- index = 0
|
- index = 0
|
||||||
@ -27,14 +24,13 @@ h1 = "#{@exercise} (external user #{@external_user})"
|
|||||||
button.btn.btn-default id='play-button'
|
button.btn.btn-default id='play-button'
|
||||||
span.fa.fa-play
|
span.fa.fa-play
|
||||||
#submissions-slider.flex-item
|
#submissions-slider.flex-item
|
||||||
input type='range' orient='horizontal' list='datapoints' min=0 max=submissions.length-1 value=0
|
input type='range' orient='horizontal' list='datapoints' min=0 max=@submissions.length-1 value=0
|
||||||
datalist#datapoints
|
datalist#datapoints
|
||||||
- index=0
|
- index=0
|
||||||
- submissions.each do |submission|
|
- @submissions.each do |submission|
|
||||||
option data-submission=submission
|
option data-submission=submission
|
||||||
=index
|
=index
|
||||||
- index += 1
|
- index += 1
|
||||||
- working_times_until = Array.new
|
|
||||||
#timeline
|
#timeline
|
||||||
.table-responsive
|
.table-responsive
|
||||||
table.table
|
table.table
|
||||||
@ -43,28 +39,26 @@ h1 = "#{@exercise} (external user #{@external_user})"
|
|||||||
- ['.time', '.cause', '.score', '.tests', '.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 > 10*60 then 0 else delta end}
|
- @submissions_and_interventions.each_with_index do |this, index|
|
||||||
- submissions_and_interventions.each_with_index do |submission_or_intervention, index|
|
tr data-id=this.id class=('highlight' if index > 0 and @working_times_until[index] == @working_times_until[index - 1])
|
||||||
tr data-id=submission_or_intervention.id
|
td.clickable = this.created_at.strftime("%F %T")
|
||||||
td.clickable = submission_or_intervention.created_at.strftime("%F %T")
|
- if this.is_a?(Submission)
|
||||||
- if submission_or_intervention.is_a?(Submission)
|
td = this.cause
|
||||||
td = submission_or_intervention.cause
|
td = this.score
|
||||||
td = submission_or_intervention.score
|
|
||||||
td
|
td
|
||||||
-submission_or_intervention.testruns.each do |run|
|
-this.testruns.each do |run|
|
||||||
- if run.passed
|
- if run.passed
|
||||||
.unit-test-result.positive-result title=run.output
|
.unit-test-result.positive-result title=run.output
|
||||||
- else
|
- else
|
||||||
.unit-test-result.unknown-result title=run.output
|
.unit-test-result.unknown-result title=run.output
|
||||||
td = Time.at(deltas[1..index].inject(:+)).utc.strftime("%H:%M:%S") if index > 0
|
td = @working_times_until[index] if index > 0
|
||||||
-working_times_until.push((Time.at(deltas[1..index].inject(:+)).utc.strftime("%H:%M:%S") if index > 0))
|
- elsif this.is_a? UserExerciseIntervention
|
||||||
- elsif submission_or_intervention.is_a? UserExerciseIntervention
|
td = this.intervention.name
|
||||||
td = submission_or_intervention.intervention.name
|
|
||||||
td =
|
td =
|
||||||
td =
|
td =
|
||||||
td =
|
td =
|
||||||
p = t('.addendum')
|
p = t('.addendum')
|
||||||
.hidden#wtimes data-working_times=ActiveSupport::JSON.encode(working_times_until);
|
.hidden#wtimes data-working_times=ActiveSupport::JSON.encode(@working_times_until);
|
||||||
div#progress_chart.col-lg-12
|
div#progress_chart.col-lg-12
|
||||||
.graph-functions-2
|
.graph-functions-2
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ de:
|
|||||||
score: Punktzahl
|
score: Punktzahl
|
||||||
tests: Unit Tests
|
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 10 Minuten werden ignoriert.'
|
||||||
proxy_exercises:
|
proxy_exercises:
|
||||||
index:
|
index:
|
||||||
clone: Duplizieren
|
clone: Duplizieren
|
||||||
|
@ -363,7 +363,7 @@ en:
|
|||||||
score: Score
|
score: Score
|
||||||
tests: Unit Test Results
|
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 10 minutes are ignored.'
|
||||||
proxy_exercises:
|
proxy_exercises:
|
||||||
index:
|
index:
|
||||||
clone: Duplicate
|
clone: Duplicate
|
||||||
|
Reference in New Issue
Block a user