<commit_before>class NotificationsController < ApplicationController
  admin_tab     :all
  before_filter :authenticate_user!
  before_filter :check_acting_as
  before_filter :check_notifications

  respond_to :js, :only => :update


  def index
  end


  def update
    begin
      notice=Notification.find params[:id].to_i
      notice.update_attribute :dismissed_at, Time.zone.now
    rescue => e
      Rails.logger.warn "#{e.message}\n#{e.backtrace.join("\n")}"
    end
  end


  private

  def check_notifications
    @notices=current_user.notifications.active.all

    if @notices.count == 0
      flash[:notice]=I18n.t 'controllers.notifications.no_notices'

      begin
        redirect_to :back
      rescue ActionController::RedirectBackError
        redirect_to root_path
      end
    end
  end

end<commit_msg>Task #48377 : Add ability to attach new orders to old existing orders; fix/make tests pass<commit_after>class NotificationsController < ApplicationController
  admin_tab     :all
  before_filter :authenticate_user!
  before_filter :check_acting_as
  before_filter :check_notifications

  respond_to :js, :only => :update


  def index
  end


  def update
    begin
      notice=Notification.find params[:id].to_i
      notice.update_attribute :dismissed_at, Time.zone.now
    rescue => e
      Rails.logger.warn "#{e.message}\n#{e.backtrace.join("\n")}"
    end

    respond_with nil
  end


  private

  def check_notifications
    @notices=current_user.notifications.active.all

    if @notices.count == 0
      flash[:notice]=I18n.t 'controllers.notifications.no_notices'

      begin
        redirect_to :back
      rescue ActionController::RedirectBackError
        redirect_to root_path
      end
    end
  end

end
{'fraction_non_alphanumeric': 0.08022922636103152, 'fraction_numerical': 0.006303724928366762, 'mean_word_length': 3.217391304347826, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5001113', 'n_tokens_mistral': 559, 'n_tokens_neox': 530, 'n_words': 119}