<commit_before># coding: utf-8
class ApplicationController < ActionController::Base

  protect_from_forgery

  helper_method :current_user, :replace_locale, :align_logo_when_home, :is_homepage?, :namespace,
                :fb_admins, :has_institutional_videos?, :institutional_video
  before_filter :set_locale
  before_filter :detect_locale

  # TODO: Change this way to get the opendata
  before_filter do
    @total_backers = User.backers.count
    @total_backs = Backer.confirmed.count
    @total_backed = Backer.confirmed.sum(:value)
    @total_users = User.primary.count
    @total_projects = Project.visible.count
    @total_projects_success = Project.successful.count
    @total_projects_online = Project.visible.not_expired.count
    @fb_admins = [567237711]
  end

  before_filter do
    if params[:newsletter].present?
      flash[:notice] = I18n.t('newsletter_ok_body') if params[:newsletter] == 'ok'
      flash[:alert] = I18n.t('newsletter_error_body') if params[:newsletter] == 'error'
    end
  end


  private

  # Fix bug of flash that will never disapear
  # @TODO try to remove in a future rails version
  def render
    super
    flash.sweep
  end

  def has_institutional_videos?
    InstitutionalVideo.visibles.present?
  end

  def institutional_video<commit_msg>Fix bug of flash that will never disapear again<commit_after># coding: utf-8
class ApplicationController < ActionController::Base

  protect_from_forgery

  helper_method :current_user, :replace_locale, :align_logo_when_home, :is_homepage?, :namespace,
                :fb_admins, :has_institutional_videos?, :institutional_video
  before_filter :set_locale
  before_filter :detect_locale

  # TODO: Change this way to get the opendata
  before_filter do
    @total_backers = User.backers.count
    @total_backs = Backer.confirmed.count
    @total_backed = Backer.confirmed.sum(:value)
    @total_users = User.primary.count
    @total_projects = Project.visible.count
    @total_projects_success = Project.successful.count
    @total_projects_online = Project.visible.not_expired.count
    @fb_admins = [567237711]
  end

  before_filter do
    if params[:newsletter].present?
      flash[:notice] = I18n.t('newsletter_ok_body') if params[:newsletter] == 'ok'
      flash[:alert] = I18n.t('newsletter_error_body') if params[:newsletter] == 'error'
    end
  end


  private

  # Fix bug of flash that will never disapear
  # @TODO try to remove in a future rails version
  def render(*args)
    super(*args)
    flash.sweep
  end

  def has_institutional_videos?
    InstitutionalVideo.visibles.present?
  end

  def institutional_video
{'fraction_non_alphanumeric': 0.08689024390243902, 'fraction_numerical': 0.010670731707317074, 'mean_word_length': 4.116959064327485, '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': '5616485', 'n_tokens_mistral': 869, 'n_tokens_neox': 818, 'n_words': 191}