h1 = link_to_if(policy(@exercise).show?, @exercise, exercise_path(@exercise))

.feedback-page
  .header = t('activerecord.attributes.exercise.description')
  .value = render_markdown(@exercise.description)

  span.header.col-sm-3.pl-0 = "#{t('activerecord.attributes.exercise.maximum_score')}"
  span.col-sm-9 = @exercise.maximum_score

  .header.mt-3 = t('activerecord.models.user_exercise_feedback.other')
  - if @feedbacks.nil? or @feedbacks.size == 0
    .no-feedback = t('user_exercise_feedback.no_feedback')

  ul.list-unstyled
    - comment_presets = UserExerciseFeedbacksController.new.comment_presets
    - time_presets = UserExerciseFeedbacksController.new.time_presets
    - @feedbacks.each_with_index do |feedback, index|
      li.card.mt-2
        .card-header role="tab" id="heading"
          div.clearfix.feedback-header
            - if policy(@exercise).detailed_statistics?
              span.username = link_to_if(policy(feedback.user).show?, feedback.user.displayname, statistics_external_user_exercise_path(id: @exercise.id, external_user_id: feedback.user.id))
            - if feedback.anomaly_notification
              i class="fa fa-envelope-o" data-placement="top" data-toggle="tooltip" data-container="body" title=feedback.anomaly_notification.reason
            span.date = feedback.created_at
        .card-collapse role="tabpanel"
          .card-body.feedback
            .text = render_markdown(feedback.feedback_text)
            .difficulty = "#{t('user_exercise_feedback.difficulty')} #{comment_presets[feedback.difficulty].join(' - ')}" if feedback.difficulty
            .worktime = "#{t('user_exercise_feedback.working_time')} #{time_presets[feedback.user_estimated_worktime].join(' - ')}" if feedback.user_estimated_worktime
        - if policy(@exercise).detailed_statistics?
          .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}"

  = render('shared/pagination', collection: @feedbacks)

  script type="text/javascript" $(function () { $('[data-toggle="tooltip"]').tooltip() });
