Show up to three submissions for teachers and add overview to table

This commit is contained in:
Sebastian Serth
2020-05-08 11:35:11 +02:00
parent 72c59c3816
commit 413ec9f956
7 changed files with 33 additions and 11 deletions

View File

@@ -4,15 +4,16 @@ h1 = t('.title')
- exercises = Exercise.where(id: submissions.joins(:exercise).group(:exercise_id).select(:exercise_id).distinct)
- if !policy(exercises.first).detailed_statistics?
- 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.table.table-striped.sortable
thead
tr
th.header = t('.exercise')
th.header = t('.score')
th.header = t('.deadline')
th.header = t('.runs') if policy(exercises.first).detailed_statistics?
th.header = t('.worktime') if policy(exercises.first).detailed_statistics?
tbody
@@ -24,6 +25,13 @@ h1 = t('.title')
tr
td = link_to exercise, controller: "exercises", action: "statistics", external_user_id: @user.id, id: exercise.id
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["working_time"] or 0 if policy(exercises.first).detailed_statistics?
- else