Show up to three submissions for teachers and add overview to table
This commit is contained in:
@ -418,9 +418,11 @@ class ExercisesController < ApplicationController
|
|||||||
@working_times_until.push((format_time_difference(@deltas[0..index].inject(:+)) if index > 0))
|
@working_times_until.push((format_time_difference(@deltas[0..index].inject(:+)) if index > 0))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
latest_submissions = Submission.where(user: @external_user, exercise_id: @exercise.id).in_study_group_of(current_user).final.latest
|
final_submissions = Submission.where(user: @external_user, exercise_id: @exercise.id).in_study_group_of(current_user).final
|
||||||
relevant_submissions = latest_submissions.before_deadline.or(latest_submissions.within_grace_period).or(latest_submissions.after_late_deadline)
|
@submissions = []
|
||||||
@submissions = relevant_submissions.sort_by(&:created_at)
|
@submissions.push final_submissions.before_deadline.latest
|
||||||
|
@submissions.push final_submissions.within_grace_period.latest
|
||||||
|
@submissions.push final_submissions.after_late_deadline.latest
|
||||||
@all_events = @submissions
|
@all_events = @submissions
|
||||||
end
|
end
|
||||||
render 'exercises/external_users/statistics'
|
render 'exercises/external_users/statistics'
|
||||||
|
@ -27,7 +27,7 @@ class Submission < ApplicationRecord
|
|||||||
scope :within_grace_period, -> { joins(:exercise).where('(submissions.updated_at > exercises.submission_deadline) AND (submissions.updated_at <= exercises.late_submission_deadline OR exercises.late_submission_deadline IS NULL)') }
|
scope :within_grace_period, -> { joins(:exercise).where('(submissions.updated_at > exercises.submission_deadline) AND (submissions.updated_at <= exercises.late_submission_deadline OR exercises.late_submission_deadline IS NULL)') }
|
||||||
scope :after_late_deadline, -> { joins(:exercise).where('submissions.updated_at > exercises.late_submission_deadline') }
|
scope :after_late_deadline, -> { joins(:exercise).where('submissions.updated_at > exercises.late_submission_deadline') }
|
||||||
|
|
||||||
scope :latest, -> { order(updated_at: :desc).limit(1) }
|
scope :latest, -> { order(updated_at: :desc).first }
|
||||||
|
|
||||||
scope :in_study_group_of, ->(user) { where(study_group_id: user.study_groups) unless user.admin? }
|
scope :in_study_group_of, ->(user) { where(study_group_id: user.study_groups) unless user.admin? }
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ h1 = "#{@exercise} (external user #{link_to_if(policy(@external_user).show?, @ex
|
|||||||
th.header = t('.time_difference') if policy(@exercise).detailed_statistics?
|
th.header = t('.time_difference') if policy(@exercise).detailed_statistics?
|
||||||
tbody
|
tbody
|
||||||
- @all_events.each_with_index do |this, index|
|
- @all_events.each_with_index do |this, index|
|
||||||
- highlight = (index > 0 and @deltas[index] == 0 and this.created_at.to_s != @all_events[index - 1].created_at.to_s)
|
- highlight = (index > 0 and @deltas.present? and @deltas[index] == 0 and this.created_at.to_s != @all_events[index - 1].created_at.to_s)
|
||||||
- row_classes = ''
|
- row_classes = ''
|
||||||
- row_classes += ' highlight' if highlight
|
- row_classes += ' highlight' if highlight
|
||||||
- row_classes += ' before_deadline' if this.is_a?(Submission) && this.before_deadline?
|
- row_classes += ' before_deadline' if this.is_a?(Submission) && this.before_deadline?
|
||||||
|
@ -42,14 +42,15 @@ h1 = @exercise
|
|||||||
- submissions = Submission.where(user: @exercise.send(symbol).distinct, exercise: @exercise).in_study_group_of(current_user)
|
- submissions = Submission.where(user: @exercise.send(symbol).distinct, exercise: @exercise).in_study_group_of(current_user)
|
||||||
- if !policy(@exercise).detailed_statistics?
|
- if !policy(@exercise).detailed_statistics?
|
||||||
- submissions = submissions.final
|
- submissions = submissions.final
|
||||||
- any_viewable_submission = submissions.first
|
- latest_submission = submissions.latest
|
||||||
- if any_viewable_submission
|
- if latest_submission
|
||||||
.table-responsive
|
.table-responsive
|
||||||
table.table.table-striped.sortable
|
table.table.table-striped.sortable
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
th.header = t('.user')
|
th.header = t('.user')
|
||||||
th.header = t('.score')
|
th.header = t('.score')
|
||||||
|
th.header = t('.deadline')
|
||||||
th.header = t('.runs') if policy(@exercise).detailed_statistics?
|
th.header = t('.runs') if policy(@exercise).detailed_statistics?
|
||||||
th.header = t('.worktime') if policy(@exercise).detailed_statistics?
|
th.header = t('.worktime') if policy(@exercise).detailed_statistics?
|
||||||
tbody
|
tbody
|
||||||
@ -60,5 +61,12 @@ h1 = @exercise
|
|||||||
tr
|
tr
|
||||||
td = link_to_if symbol==:external_users && policy(user).statistics?, label, {controller: "exercises", action: "statistics", external_user_id: user.id, id: @exercise.id}
|
td = link_to_if symbol==:external_users && policy(user).statistics?, label, {controller: "exercises", action: "statistics", external_user_id: user.id, id: @exercise.id}
|
||||||
td = us['maximum_score'] or 0
|
td = us['maximum_score'] or 0
|
||||||
|
td.align-middle
|
||||||
|
- if latest_submission.before_deadline?
|
||||||
|
.unit-test-result.positive-result.before_deadline
|
||||||
|
- elsif latest_submission.within_grace_period?
|
||||||
|
.unit-test-result.unknown-result.within_grace_period
|
||||||
|
- elsif latest_submission.after_late_deadline?
|
||||||
|
.unit-test-result.negative-result.after_late_deadline
|
||||||
td = us['runs'] if policy(@exercise).detailed_statistics?
|
td = us['runs'] if policy(@exercise).detailed_statistics?
|
||||||
td = @exercise.average_working_time_for(user.id) or 0 if policy(@exercise).detailed_statistics?
|
td = @exercise.average_working_time_for(user.id) or 0 if policy(@exercise).detailed_statistics?
|
||||||
|
@ -4,15 +4,16 @@ h1 = t('.title')
|
|||||||
- exercises = Exercise.where(id: submissions.joins(:exercise).group(:exercise_id).select(:exercise_id).distinct)
|
- exercises = Exercise.where(id: submissions.joins(:exercise).group(:exercise_id).select(:exercise_id).distinct)
|
||||||
- if !policy(exercises.first).detailed_statistics?
|
- if !policy(exercises.first).detailed_statistics?
|
||||||
- submissions = submissions.final
|
- submissions = submissions.final
|
||||||
- any_viewable_submission = submissions.first
|
- latest_viewable_submission = submissions.latest
|
||||||
|
|
||||||
- if any_viewable_submission && policy(any_viewable_submission).show_study_group?
|
- if latest_viewable_submission && policy(latest_viewable_submission).show_study_group?
|
||||||
.table-responsive
|
.table-responsive
|
||||||
table.table.table-striped.sortable
|
table.table.table-striped.sortable
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
th.header = t('.exercise')
|
th.header = t('.exercise')
|
||||||
th.header = t('.score')
|
th.header = t('.score')
|
||||||
|
th.header = t('.deadline')
|
||||||
th.header = t('.runs') if policy(exercises.first).detailed_statistics?
|
th.header = t('.runs') if policy(exercises.first).detailed_statistics?
|
||||||
th.header = t('.worktime') if policy(exercises.first).detailed_statistics?
|
th.header = t('.worktime') if policy(exercises.first).detailed_statistics?
|
||||||
tbody
|
tbody
|
||||||
@ -24,6 +25,13 @@ h1 = t('.title')
|
|||||||
tr
|
tr
|
||||||
td = link_to exercise, controller: "exercises", action: "statistics", external_user_id: @user.id, id: exercise.id
|
td = link_to exercise, controller: "exercises", action: "statistics", external_user_id: @user.id, id: exercise.id
|
||||||
td = stats["maximum_score"] or 0
|
td = stats["maximum_score"] or 0
|
||||||
|
td.align-middle
|
||||||
|
- if latest_viewable_submission.before_deadline?
|
||||||
|
.unit-test-result.positive-result.before_deadline
|
||||||
|
- elsif latest_viewable_submission.within_grace_period?
|
||||||
|
.unit-test-result.unknown-result.within_grace_period
|
||||||
|
- elsif latest_viewable_submission.after_late_deadline?
|
||||||
|
.unit-test-result.negative-result.after_late_deadline
|
||||||
td = stats["runs"] or 0 if policy(exercises.first).detailed_statistics?
|
td = stats["runs"] or 0 if policy(exercises.first).detailed_statistics?
|
||||||
td = stats["working_time"] or 0 if policy(exercises.first).detailed_statistics?
|
td = stats["working_time"] or 0 if policy(exercises.first).detailed_statistics?
|
||||||
- else
|
- else
|
||||||
|
@ -414,6 +414,7 @@ de:
|
|||||||
users: '%{count} verschiedene Nutzer'
|
users: '%{count} verschiedene Nutzer'
|
||||||
user: Nutzer
|
user: Nutzer
|
||||||
score: Maximale Punktzahl
|
score: Maximale Punktzahl
|
||||||
|
deadline: Abgabefrist
|
||||||
runs: Versuche
|
runs: Versuche
|
||||||
worktime: Arbeitszeit
|
worktime: Arbeitszeit
|
||||||
average_worktime: Durchschnittliche Arbeitszeit
|
average_worktime: Durchschnittliche Arbeitszeit
|
||||||
@ -434,7 +435,7 @@ de:
|
|||||||
external_users:
|
external_users:
|
||||||
statistics:
|
statistics:
|
||||||
no_data_available: Keine Daten verfügbar oder fehlende Berechtigungen.
|
no_data_available: Keine Daten verfügbar oder fehlende Berechtigungen.
|
||||||
time: Zeit
|
time: Zeit (UTC)
|
||||||
cause: Grund
|
cause: Grund
|
||||||
score: Punktzahl
|
score: Punktzahl
|
||||||
tests: Unit Tests
|
tests: Unit Tests
|
||||||
@ -453,6 +454,7 @@ de:
|
|||||||
title: Statistiken für Externe Benutzer
|
title: Statistiken für Externe Benutzer
|
||||||
exercise: Übung
|
exercise: Übung
|
||||||
score: Maximale Punktzahl
|
score: Maximale Punktzahl
|
||||||
|
deadline: Abgabefrist
|
||||||
runs: Abgaben
|
runs: Abgaben
|
||||||
worktime: Arbeitszeit
|
worktime: Arbeitszeit
|
||||||
show:
|
show:
|
||||||
|
@ -414,6 +414,7 @@ en:
|
|||||||
users: '%{count} distinct users'
|
users: '%{count} distinct users'
|
||||||
user: User
|
user: User
|
||||||
score: Maximum Score
|
score: Maximum Score
|
||||||
|
deadline: Deadline
|
||||||
runs: Runs
|
runs: Runs
|
||||||
worktime: Working Time
|
worktime: Working Time
|
||||||
average_worktime: Average Working Time
|
average_worktime: Average Working Time
|
||||||
@ -434,7 +435,7 @@ en:
|
|||||||
external_users:
|
external_users:
|
||||||
statistics:
|
statistics:
|
||||||
no_data_available: No data available or insufficient permissions
|
no_data_available: No data available or insufficient permissions
|
||||||
time: Time
|
time: Time (UTC)
|
||||||
cause: Cause
|
cause: Cause
|
||||||
score: Score
|
score: Score
|
||||||
tests: Unit Test Results
|
tests: Unit Test Results
|
||||||
@ -453,6 +454,7 @@ en:
|
|||||||
title: External User Statistics
|
title: External User Statistics
|
||||||
exercise: Exercise
|
exercise: Exercise
|
||||||
score: Maximum Score
|
score: Maximum Score
|
||||||
|
deadline: Deadline
|
||||||
runs: Submissions
|
runs: Submissions
|
||||||
worktime: Working Time
|
worktime: Working Time
|
||||||
show:
|
show:
|
||||||
|
Reference in New Issue
Block a user