Files
codeocean/app/views/exercise_collections/statistics.html.slim
Sebastian Serth a99da79550 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
2023-03-14 18:27:38 +01:00

52 lines
3.2 KiB
Plaintext

h1 = @exercise_collection
= row(label: 'exercise_collections.name', value: @exercise_collection.name)
= row(label: 'exercise_collections.updated_at', value: @exercise_collection.updated_at)
= row(label: 'exercise_collections.exercises', value: @exercise_collection.exercises.count)
= row(label: 'exercise_collections.users', value: @exercise_collection.exercises.joins(:submissions).group("submissions.user_id").count.count)
= row(label: 'exercise_collections.solutions', value: @exercise_collection.exercises.joins(:submissions).group("submissions.user_id").group("id").count.count)
= row(label: 'exercise_collections.submissions', value: @exercise_collection.exercises.joins(:submissions).count)
/ further metrics:
/ number of users that attempted at least one exercise @exercise_collection.exercises.joins(:submissions).group("submissions.user_id").count.count
/ number of solutions: @exercise_collection.exercises.joins(:submissions).group("submissions.user_id").group("id").count.count
/ further filters:
/ Only before specific date: date = DateTime.parse("2015-01-01 00:00:00.000000") ; @exercise_collection.exercises.joins(:submissions).where(["submissions.created_at > ?", date]).group("submissions.user_id").count.count
/ Only with specific cause: @exercise_collection.exercises.joins(:submissions).where("submissions.cause" == 'assess').count
= row(label: 'exercises.statistics.average_worktime', value: @exercise_collection.average_working_time.round(3).to_s + 's')
#graph
#data.d-none(data-working-times=ActiveSupport::JSON.encode(@exercise_collection.collection_statistics) data-average-working-time=@exercise_collection.average_working_time)
#legend
- {time: t('exercises.statistics.average_worktime'),
min: 'min. anomaly threshold',
avg: 'average time',
max: 'max. anomaly threshold'}.each_pair do |klass, label|
.legend-entry
div(class="box #{klass}")
.box-label = label
h4.mt-4 = t('activerecord.attributes.exercise_collections.exercises')
.table-responsive#exercise-list
table.table class="#{@exercise_collection.items.present? ? 'sortable' : ''}"
thead
tr
th = '#'
th = t('activerecord.attributes.exercise.title')
th = t('activerecord.attributes.exercise.number_of_users')
th = t('activerecord.attributes.exercise.distinct_final_submissions')
th = t('activerecord.attributes.exercise.finishing_rate')
th = t('activerecord.attributes.exercise.average_score_percentage')
th = t('shared.actions')
tbody
- @exercise_collection.items.sort_by{|item| item.position}.each do |exercise_collection_item|
- exercise = exercise_collection_item.exercise
tr
td = exercise_collection_item.position
td = link_to_if(policy(exercise).show?, exercise.title, exercise)
td = exercise.users.distinct.count
td = exercise.submissions.send(:final).distinct.count(:user_id)
td = exercise.finishers_percentage
td = exercise.average_percentage
td = link_to(t('shared.statistics'), statistics_exercise_path(exercise), 'data-turbolinks' => "false") if policy(exercise).statistics?