<commit_before>class AssignmentExportsController < ApplicationController
  before_filter :ensure_staff?

  def create
    @assignment_export_job = AssignmentExportJob.new({
      assignment_id: params[:assignment_id],
      professor_id: current_user.id,
      course_id: current_course.id,
      team_id: params[:team_id]
    })

    @job_enqueued = @assignment_export_job.enqueue
    write_flash_response

  end

  protected

  def write_flash_response
    if @job_enqueued
      flash[:notice] = "Your archive is being prepared. You'll receive an email when it's complete."
    else
      flash[:warning] = "Your archive failed to build. An administrator has been contacted about the issue."
    end
  end
end<commit_msg>add flash outcomes to assignment export generation<commit_after>class AssignmentExportsController < ApplicationController
  before_filter :ensure_staff?

  def create
    @assignment_export_job = AssignmentExportJob.new({
      assignment_id: params[:assignment_id],
      professor_id: current_user.id,
      course_id: current_course.id,
      team_id: params[:team_id]
    })

    @job_enqueued = @assignment_export_job.enqueue
    register_flash_response

    redirect_to exports_path
  end

  protected

  def register_flash_response
    if @job_enqueued
      flash[:success] = "Your assignment export is being prepared. You'll receive an email when it's complete."
    else
      flash[:alert] = "Your assignment export failed to build. An administrator has been contacted about the issue."
    end
  end
end
{'fraction_non_alphanumeric': 0.06627680311890838, 'fraction_numerical': 0.0, 'mean_word_length': 3.858044164037855, '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': '3826041', 'n_tokens_mistral': 447, 'n_tokens_neox': 434, 'n_words': 123}