<commit_before># Trying out having a separate controller from the central surveyor one.
class ResponseSetsController < ApplicationController

  load_and_authorize_resource

  def destroy
    @response_set.destroy
    redirect_to dashboard_path, notice: t('dashboard.deleted_response_set')
  end

  def publish
    begin
      @response_set.publish!
      redirect_to dashboard_path, notice: t('dashboard.published_response_set')
    rescue AASM::InvalidTransition
      redirect_to dashboard_path, warning: t('dashboard.unable_to_publish_response_set_invalid')
    end
  end

  rescue_from CanCan::AccessDenied do |exception|  
    redirect_to dashboard_path, warning: t('dashboard.unable_to_access_response_set')<commit_msg>fixed warning notices in redirect_to (doesn't support :warning)<commit_after># Trying out having a separate controller from the central surveyor one.
class ResponseSetsController < ApplicationController

  load_and_authorize_resource

  def destroy
    @response_set.destroy
    redirect_to dashboard_path, notice: t('dashboard.deleted_response_set')
  end

  def publish
    begin
      @response_set.publish!
      redirect_to dashboard_path, notice: t('dashboard.published_response_set')
    rescue AASM::InvalidTransition
      redirect_to dashboard_path, alert: t('dashboard.unable_to_publish_response_set_invalid')
    end
  end

  rescue_from CanCan::AccessDenied do |exception|  
    redirect_to dashboard_path, alert: t('dashboard.unable_to_access_response_set')
{'fraction_non_alphanumeric': 0.06283422459893048, 'fraction_numerical': 0.0, 'mean_word_length': 5.2899159663865545, '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': '663312', 'n_tokens_mistral': 431, 'n_tokens_neox': 420, 'n_words': 102}