<commit_before>class FacilitiesController < ApplicationController
  before_action :set_facility, only: [:show, :edit, :update, :destroy]
  load_and_authorize_resource

  # GET /facilities/1
  # GET /facilities/1.json
  def show
    @breadcrumbs = [["Home", root_url], [@facility.citizen,"/citizens/#{@facility.citizen.id}?tab=facilities"], [@facility, "/facilities/#{@facility.id}"]]
  end

  # GET /facilities/new
  def new
    @facility = Facility.new
    @facility_types = (current_user && current_user.citizen ? FacilityType.buildable_and_affordable(current_user.citizen.credits) : [])
    @breadcrumbs = [["Home", root_url], [@facility.citizen,"/citizens/#{@facility.citizen.id}?tab=facilities"]]
    if @facility_types.empty?
      respond_to do |format|
        format.html { redirect_to current_user.citizen , alert: 'No suitable facilities can be built.' }
      end
    end
  end

  # GET /facilities/1/edit
  def edit
    @breadcrumbs = [["Home", root_url], [@facility.citizen,"/citizens/#{@facility.citizen.id}?tab=facilities"], [@facility, "/facilities/#{@facility.id}"]]
  end

  # POST /facilities<commit_msg>fix new facility<commit_after>class FacilitiesController < ApplicationController
  before_action :set_facility, only: [:show, :edit, :update, :destroy]
  load_and_authorize_resource

  # GET /facilities/1
  # GET /facilities/1.json
  def show
    @breadcrumbs = [["Home", root_url], [@facility.citizen,"/citizens/#{@facility.citizen.id}?tab=facilities"], [@facility, "/facilities/#{@facility.id}"]]
  end

  # GET /facilities/new
  def new
    @facility = Facility.new
    @facility_types = (current_user && current_user.citizen ? FacilityType.buildable_and_affordable(current_user.citizen.credits) : [])
    @breadcrumbs = [["Home", root_url], [@facility.citizen,"/citizens/#{current_user.citizen.id}?tab=facilities"]]
    if @facility_types.empty?
      respond_to do |format|
        format.html { redirect_to current_user.citizen , alert: 'No suitable facilities can be built.' }
      end
    end
  end

  # GET /facilities/1/edit
  def edit
    @breadcrumbs = [["Home", root_url], [@facility.citizen,"/citizens/#{@facility.citizen.id}?tab=facilities"], [@facility, "/facilities/#{@facility.id}"]]
  end

  # POST /facilities
{'fraction_non_alphanumeric': 0.15394853593611357, 'fraction_numerical': 0.0026619343389529724, 'mean_word_length': 4.460048426150121, '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': '5615498', 'n_tokens_mistral': 807, 'n_tokens_neox': 770, 'n_words': 139}