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)

- Hash[:internal_users => t('.internal_users'), :external_users => t('.external_users')].each_pair do |symbol, label|
  strong = label
  .table-responsive
    table.table
      thead
        tr
          - ['.user', '.score', '.runs', '.worktime'].each do |title|
            th.header = t(title)
      tbody
        - @exercise.send(symbol).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')
            td = @exercise.average_working_time_for(user.id) or 0

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)

- Hash[:internal_users => t('.internal_users'), :external_users => t('.external_users')].each_pair do |symbol, label|
  strong = label
  .table-responsive
    table.table
      thead
        tr
          - ['.user', '.score', '.runs', '.worktime'].each do |title|
            th.header = t(title)
      tbody
        - @exercise.send(symbol).distinct().each do |user|
          tr
            - submissions = @exercise.submissions.where('user_id=?', user.id)
            td = "#{user.name} (#{user.email})"
            td = submissions.maximum('score') or 0
            td = submissions.count('id')
            td = @exercise.average_working_time_for(user.id) or 0

Use default value for missing scores
Use default value for missing scores

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