<commit_before>class PlanningApplicationsController < ApplicationController
  before_filter :set_planning_application, on: [:show, :show_uid, :geometry]
  respond_to :js, only: [:hide, :unhide]

  def show
  end

  def geometry
    if @planning_application.location
      respond_to do |format|
        format.json { render json: RGeo::GeoJSON.encode(planning_application_feature(@planning_application)) }
      end
    else
      head :no_content
    end
  end

  def search
    @query = params[:q].strip
    planning_applications = PlanningApplication.where("uid LIKE ?", "%#{@query}%").page params[:page]
    @planning_applications = PlanningApplicationDecorator.decorate_collection planning_applications
  end

  def show_uid
    render action: :show
  end

  def hide
    planning_application = PlanningApplication.find params[:id]
    hide_vote = planning_application.hide_votes.new.tap {|pl| pl.user = current_user}
    hide_vote.save

    @planning_application = PlanningApplicationDecorator.decorate planning_application.reload

    respond_to do |format|
      format.js {}
      format.html { render :show }
    end
  end

  def unhide
    planning_application = PlanningApplication.find params[:id]
    planning_application.hide_votes.find_by_user_id(current_user.id).destroy

    @planning_application = PlanningApplicationDecorator.decorate planning_application.reload

    respond_to do |format|
      format.js {}<commit_msg>Make planning app search case insensitive<commit_after>class PlanningApplicationsController < ApplicationController
  before_filter :set_planning_application, on: [:show, :show_uid, :geometry]
  respond_to :js, only: [:hide, :unhide]

  def show
  end

  def geometry
    if @planning_application.location
      respond_to do |format|
        format.json { render json: RGeo::GeoJSON.encode(planning_application_feature(@planning_application)) }
      end
    else
      head :no_content
    end
  end

  def search
    @query = params[:q].strip
    planning_applications = PlanningApplication.where("uid ILIKE ?", "%#{@query}%").page params[:page]
    @planning_applications = PlanningApplicationDecorator.decorate_collection planning_applications
  end

  def show_uid
    render action: :show
  end

  def hide
    planning_application = PlanningApplication.find params[:id]
    hide_vote = planning_application.hide_votes.new.tap {|pl| pl.user = current_user}
    hide_vote.save

    @planning_application = PlanningApplicationDecorator.decorate planning_application.reload

    respond_to do |format|
      format.js {}
      format.html { render :show }
    end
  end

  def unhide
    planning_application = PlanningApplication.find params[:id]
    planning_application.hide_votes.find_by_user_id(current_user.id).destroy

    @planning_application = PlanningApplicationDecorator.decorate planning_application.reload

    respond_to do |format|
      format.js {}
{'fraction_non_alphanumeric': 0.08175884575747167, 'fraction_numerical': 0.0, 'mean_word_length': 4.181494661921708, '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': '409829', 'n_tokens_mistral': 860, 'n_tokens_neox': 841, 'n_words': 183}