Disable sorttable on tables without rows
Otherwise, the first element of the table body is being fetched which might result in an error for empty tables. Fixes CODEOCEAN-JZ
This commit is contained in:
@@ -61,8 +61,9 @@ h1 = @exercise
|
||||
- if !policy(@exercise).detailed_statistics?
|
||||
- submissions = submissions.final
|
||||
- if submissions.any?
|
||||
- users = symbol.to_s.classify.constantize.where(id: submissions.joins(symbol).group(:user_id).select(:user_id).distinct)
|
||||
.table-responsive
|
||||
table.table.table-striped.sortable
|
||||
table.table.table-striped class="#{users.present? ? 'sortable' : ''}"
|
||||
thead
|
||||
tr
|
||||
th.header = t('.user')
|
||||
@@ -71,7 +72,6 @@ h1 = @exercise
|
||||
th.header = t('.runs') if policy(@exercise).detailed_statistics?
|
||||
th.header = t('.worktime') if policy(@exercise).detailed_statistics?
|
||||
tbody
|
||||
- users = symbol.to_s.classify.constantize.where(id: submissions.joins(symbol).group(:user_id).select(:user_id).distinct)
|
||||
- users.each do |user|
|
||||
- if user_statistics[user.class.name][user.id] then us = user_statistics[user.class.name][user.id] else us = {"maximum_score" => nil, "runs" => nil}
|
||||
- label = "#{user.displayname}"
|
||||
|
Reference in New Issue
Block a user