<commit_before>h1 = Submission.model_name.human(count: 2)

= render(layout: 'shared/form_filters') do |f|
  .row.px-3
    .form-group
      = f.label(:exercise_id_eq, t('activerecord.attributes.submission.exercise'), class: 'sr-only')
      = f.collection_select(:exercise_id_eq, Exercise.with_submissions, :id, :title, class: 'form-control', prompt: t('activerecord.attributes.submission.exercise'))
    .form-group
      = f.label(:cause_eq, t('activerecord.attributes.submission.cause'), class: 'sr-only')
      = f.select(:cause_eq, Submission.select(:cause).distinct.map(&:cause).sort, class: 'form-control', prompt: t('activerecord.attributes.submission.cause'))

.table-responsive
  table.table.mt-4
    thead
      tr
        th = sort_link(@search, :exercise_id, t('activerecord.attributes.submission.exercise'))
        th = sort_link(@search, :user_id, t('activerecord.attributes.submission.user'))
        th = sort_link(@search, :cause, t('activerecord.attributes.submission.cause'))
        th = sort_link(@search, :score, t('activerecord.attributes.submission.score'))
        th = sort_link(@search, :created_at, t('shared.created_at'))
        th colspan=2 = t('shared.actions')
    tbody
      - @submissions.each do |submission|
        tr
          td = link_to_if(policy(submission.exercise).show?, submission.exercise, submission.exercise)
          td = link_to_if(policy(submission.user).show?, submission.user, submission.user)
          td = t("submissions.causes.#{submission.cause}")
          td = submission.score
          td = l(submission.created_at, format: :short)
          td = link_to(t('shared.show'), submission) if policy(submission).show?
          td = link_to(t('shared.statistics'), statistics_submission_path(submission)) if policy(submission).statistics?

= render('shared/pagination', collection: @submissions)<commit_msg>Fix submission view if exercise is deleted<commit_after>h1 = Submission.model_name.human(count: 2)

= render(layout: 'shared/form_filters') do |f|
  .row.px-3
    .form-group
      = f.label(:exercise_id_eq, t('activerecord.attributes.submission.exercise'), class: 'sr-only')
      = f.collection_select(:exercise_id_eq, Exercise.with_submissions, :id, :title, class: 'form-control', prompt: t('activerecord.attributes.submission.exercise'))
    .form-group
      = f.label(:cause_eq, t('activerecord.attributes.submission.cause'), class: 'sr-only')
      = f.select(:cause_eq, Submission.select(:cause).distinct.map(&:cause).sort, class: 'form-control', prompt: t('activerecord.attributes.submission.cause'))

.table-responsive
  table.table.mt-4
    thead
      tr
        th = sort_link(@search, :exercise_id, t('activerecord.attributes.submission.exercise'))
        th = sort_link(@search, :user_id, t('activerecord.attributes.submission.user'))
        th = sort_link(@search, :cause, t('activerecord.attributes.submission.cause'))
        th = sort_link(@search, :score, t('activerecord.attributes.submission.score'))
        th = sort_link(@search, :created_at, t('shared.created_at'))
        th colspan=2 = t('shared.actions')
    tbody
      - @submissions.each do |submission|
        tr
          td = link_to_if(submission.exercise && policy(submission.exercise).show?, submission.exercise, submission.exercise)
          td = link_to_if(policy(submission.user).show?, submission.user, submission.user)
          td = t("submissions.causes.#{submission.cause}")
          td = submission.score
          td = l(submission.created_at, format: :short)
          td = link_to(t('shared.show'), submission) if policy(submission).show? && submission.exercise
          td = link_to(t('shared.statistics'), statistics_submission_path(submission)) if policy(submission).statistics?

= render('shared/pagination', collection: @submissions)
{'fraction_non_alphanumeric': 0.14993446920052425, 'fraction_numerical': 0.002621231979030144, 'mean_word_length': 4.040951122853369, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3502779', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1164, 'n_words': 193}