<commit_before>class Assessment::MissionSubmissionsController < Assessment::SubmissionsController
  before_filter :authorize, only: [:new, :create, :edit, :update]
  before_filter :no_update_after_submission, only: [:edit, :update]

  def show
    # if student is still attempting a mission, redirect to edit page
    if @submission.attempting? and @submission.std_course == curr_user_course
      redirect_to edit_course_assessment_submission_path(@course, @assessment, @submission)
      return
    end

    #if staff is accessing the submitted mission, redirect to grading page
    if curr_user_course.is_staff? and (@submission.submitted? or @submission.graded?)
        redirect_to new_course_assessment_submission_grading_path(@course, @assessment, @submission)
      return
    end

    if @submission.graded?
      grading = @submission.gradings.first
      redirect_to course_assessment_submission_grading_path(@course, @assessment, @submission,grading)
    end
  end


  def create
    update
  end

  def edit
    @mission = @assessment.as_assessment
    @questions = @assessment.questions
    @submission.build_initial_answers
  end

  def update
    @submission.fetch_params_answers(params)
    if params[:files]
      @submission.attach_files(params[:files].values)
    end
<commit_msg>evaluate answer in mission_submission show action for staff<commit_after>class Assessment::MissionSubmissionsController < Assessment::SubmissionsController
  before_filter :authorize, only: [:new, :create, :edit, :update]
  before_filter :no_update_after_submission, only: [:edit, :update]

  def show
    # if student is still attempting a mission, redirect to edit page
    if @submission.attempting? and @submission.std_course == curr_user_course
      redirect_to edit_course_assessment_submission_path(@course, @assessment, @submission)
      return
    end

    #if staff is accessing the submitted mission, redirect to grading page
    if curr_user_course.is_staff? and (@submission.submitted? or @submission.graded?)
        redirect_to new_course_assessment_submission_grading_path(@course, @assessment, @submission)
      return
    end

    if @submission.graded?
      grading = @submission.gradings.first
      redirect_to course_assessment_submission_grading_path(@course, @assessment, @submission,grading)
      return
    end

    #show running results for staff when the mission is not submitted
    @submission.eval_answer if curr_user_course.is_staff?
  end


  def create
    update
  end

  def edit
    @mission = @assessment.as_assessment
    @questions = @assessment.questions
    @submission.build_initial_answers
  end

  def update
    @submission.fetch_params_answers(params)
    if params[:files]
      @submission.attach_files(params[:files].values)
    end

{'fraction_non_alphanumeric': 0.07568149210903874, 'fraction_numerical': 0.0, 'mean_word_length': 4.3634615384615385, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5010200', 'n_tokens_mistral': 850, 'n_tokens_neox': 816, 'n_words': 204}