h1 = @exercise

= row(label: '.participants', value: @exercise.users.count)
- [:intermediate, :final].each do |scope|
  = row(label: ".#{scope}_submissions") do
    = "#{@exercise.submissions.send(scope).count} (#{t('.users', count: @exercise.submissions.send(scope).distinct.count(:user_id, :user_type))})"
= row(label: '.average_score') do
  p == @exercise.average_score ? t('shared.out_of', maximum_value: @exercise.maximum_score, value: @exercise.average_score.round(2)) : empty
  p = progress_bar(@exercise.average_percentage)

.table-responsive
  table.table
    thead
      tr
        - ['.user', '.score', '.runs', '.worktime'].each do |title|
          th.header = t(title)
    tbody
      - @exercise.users.each do |user|
        tr
          - submissions = @exercise.submissions.where('user_id=?', user.id)
          td = "#{user.name} (#{user.email})"
          td = submissions.maximum('score')
          td = submissions.count('id')
          - seconds = submissions.maximum('created_at') - submissions.minimum('created_at')
          td = "#{distance_of_time_in_words(seconds)} (#{seconds})"

h1 = @exercise

= row(label: '.participants', value: @exercise.users.count)
- [:intermediate, :final].each do |scope|
  = row(label: ".#{scope}_submissions") do
    = "#{@exercise.submissions.send(scope).count} (#{t('.users', count: @exercise.submissions.send(scope).distinct.count(:user_id, :user_type))})"
= row(label: '.average_score') do
  p == @exercise.average_score ? t('shared.out_of', maximum_value: @exercise.maximum_score, value: @exercise.average_score.round(2)) : empty
  p = progress_bar(@exercise.average_percentage)

.table-responsive
  table.table
    thead
      tr
        - ['.user', '.score', '.runs', '.worktime'].each do |title|
          th.header = t(title)
    tbody
      - @exercise.users.distinct().each do |user|
        tr
          - submissions = @exercise.submissions.where('user_id=?', user.id)
          td = "#{user.name} (#{user.email})"
          td = submissions.maximum('score')
          td = submissions.count('id')
          - seconds = submissions.maximum('created_at') - submissions.minimum('created_at')
          td = "#{distance_of_time_in_words(seconds)} (#{seconds})"

Fix users being shown multiple times
Fix users being shown multiple times

openHPI/codeocean,openHPI/codeocean,openHPI/codeocean,openHPI/codeocean,openHPI/codeocean,openHPI/codeocean