<commit_before>module SubmissionsHelper

  def score(submission)
    challenge = submission.challenge
    if submission.graded?
      if challenge.secondary_sort_order == 'not_used'
        return "<li>Mean F1: #{submission.score}</li>".html_safe
      else
        return "<li>Mean F1: #{submission.score}</li><li>Mean Log Loss: #{submission.score_secondary}</li>".html_safe
      end
    else
      if submission.grading_message
        return "<li>Status: #{submission.grading_status}</li><li>#{submission.grading_message}</li>".html_safe
      else
        return "<li>Status: #{submission.grading_status}</li>".html_safe
      end
    end
  end

  def submissions_allowed?(challenge)
    return false unless challenge.online_submissions
    if challenge.running?
      return true
    else
      if current_participant && current_participant.admin?
        return true
      else
        return false
      end
    end
    if challenge.clef_challenge.present?
      if clef_participant_registered?(challenge)
        return true
      else
        return false
      end
    else
      return true
    end
  end

  def clef_participant_registered?(challenge)
    return false unless current_participant.present?
    clef_task = challenge.clef_task
    participant_clef_task = ParticipantClefTask.where(
      participant_id: current_participant,
      clef_task_id: clef_task.id).first
    if participant_clef_task
      return true if participant_clef_task.registered?
    else
      return false
    end
  end

end<commit_msg>clef create submission button<commit_after>module SubmissionsHelper

  def score(submission)
    challenge = submission.challenge
    if submission.graded?
      if challenge.secondary_sort_order == 'not_used'
        return "<li>Mean F1: #{submission.score}</li>".html_safe
      else
        return "<li>Mean F1: #{submission.score}</li><li>Mean Log Loss: #{submission.score_secondary}</li>".html_safe
      end
    else
      if submission.grading_message
        return "<li>Status: #{submission.grading_status}</li><li>#{submission.grading_message}</li>".html_safe
      else
        return "<li>Status: #{submission.grading_status}</li>".html_safe
      end
    end
  end

  def submissions_allowed?(challenge)
    return false unless challenge.online_submissions
    if challenge.running?
      if challenge.clef_challenge.present?
        if clef_participant_registered?(challenge)
          return true
        else
          return false
        end
      else
        return true
      end
    else
      if current_participant && current_participant.admin?
        return true
      else
        return false
      end
    end
  end

  def clef_participant_registered?(challenge)
    return false unless current_participant.present?
    clef_task = challenge.clef_task
    participant_clef_task = ParticipantClefTask.where(
      participant_id: current_participant,
      clef_task_id: clef_task.id).first
    if participant_clef_task
      return true if participant_clef_task.registered?
    else
      return false
    end
  end

end
{'fraction_non_alphanumeric': 0.07787151200519143, 'fraction_numerical': 0.0012978585334198572, 'mean_word_length': 2.8828715365239295, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '1763992', 'n_tokens_mistral': 929, 'n_tokens_neox': 890, 'n_words': 198}