- if can?(:attempt, video) && current_course_user
  - submission = video.submissions.select { |s| s.creator == current_user }.first
  - if submission
    = link_to t('.rewatch'),
      edit_course_video_submission_path(current_course, video, submission),
      class: ['btn', 'btn-info']
  - else
    = link_to t('.watch'), course_video_submissions_path(current_course, video),
      class: ['btn', 'btn-info'], method: :post
- else
  = link_to(t('.watch'), '#', class: ['btn', 'btn-info', 'disabled'])

- if can?(:attempt, video) && current_course_user
  - submission = video.submissions.by_user(current_user).first
  - if submission
    = link_to t('.rewatch'),
      edit_course_video_submission_path(current_course, video, submission),
      class: ['btn', 'btn-info']
  - else
    = link_to t('.watch'), course_video_submissions_path(current_course, video),
      class: ['btn', 'btn-info'], method: :post
- else
  = link_to(t('.watch'), '#', class: ['btn', 'btn-info', 'disabled'])

Fix N+1 queries in video_attempt_button
Fix N+1 queries in video_attempt_button

Coursemology/coursemology2,Coursemology/coursemology2,cysjonathan/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,cysjonathan/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,cysjonathan/coursemology2