Fix working time statistics for internal and external users

This commit is contained in:
Sebastian Serth
2022-01-20 23:41:32 +01:00
parent 11fc31877f
commit ba11adb966
3 changed files with 7 additions and 7 deletions

View File

@ -32,7 +32,7 @@ h1 = link_to_if(policy(@exercise).show?, @exercise, exercise_path(@exercise))
.card-footer
div.clearfix.feedback-header
span.points.flex-grow-1 = "#{t('exercises.statistics.score')}: #{@submissions[index].score}"
span.working_time.pull-right = "#{t('exercises.statistics.worktime')}: #{@exercise.average_working_time_for(feedback.user.id) or 0}"
span.working_time.pull-right = "#{t('exercises.statistics.worktime')}: #{@exercise.average_working_time_for(feedback.user) or 0}"
= render('shared/pagination', collection: @feedbacks)

View File

@ -48,7 +48,7 @@ h1 = @exercise
- if symbol==:external_users
- working_time_array = []
- @exercise.send(symbol).distinct().each do |user|
- working_time = @exercise.average_working_time_for(user.id) or 0
- working_time = @exercise.average_working_time_for(user) or 0
- working_time_array.push working_time
hr
.d-none#data data-working-time=ActiveSupport::JSON.encode(working_time_array)
@ -88,4 +88,4 @@ h1 = @exercise
- elsif latest_user_submission.after_late_deadline?
.unit-test-result.negative-result.after_late_deadline
td = us['runs'] if policy(@exercise).detailed_statistics?
td = @exercise.average_working_time_for(user.id) or 0 if policy(@exercise).detailed_statistics?
td = @exercise.average_working_time_for(user) or 0 if policy(@exercise).detailed_statistics?