<commit_before>class LocationsController < ApplicationController
  include Requested
  before_action :set_location, only: [:show, :edit, :update, :destroy]

  @@geocodejob = GeocodeJob
  def LocationsController::geocodejob=(klass)
    @@geocodejob = klass
  end
  def LocationsController::geocodejob
    @@geocodejob
  end

  # GET /locations/current
  # GET /locations/current.json
  def current
    @location = Location.where(host: src_addr_on_header).order(updated_at: :desc).first
    if not @location or @location.expired?
      new
      @location.save! # assign an id to be presneted to the front end
      @@geocodejob.perform_later(id: @location.id, host: @location.host)
    end
    # TODO: respond_to
  end

  # GET /locations
  # GET /locations.json
  def index
    @locations = Location.all
  end

  # GET /locations/1
  # GET /locations/1.json
  def show
  end

  # GET /locations/new
  def new
    @location = Location.new
    @location.host = src_addr_on_header
  end

  # GET /locations/1/edit
  def edit
  end

  # POST /locations
  # POST /locations.json
  def create
    @@geocodejob.perform_later(location_params)

    respond_to do |format|
      format.html { redirect_to locations_url, notice: 'Location was enqued.' }
      format.json { render :show, status: :ok } # FIXME<commit_msg>Update TODO<commit_after>class LocationsController < ApplicationController
  include Requested
  before_action :set_location, only: [:show, :edit, :update, :destroy]

  @@geocodejob = GeocodeJob
  def LocationsController::geocodejob=(klass)
    @@geocodejob = klass
  end
  def LocationsController::geocodejob
    @@geocodejob
  end

  # GET /locations/current
  # GET /locations/current.json
  def current
    @location = Location.where(host: src_addr_on_header).order(updated_at: :desc).first
    if not @location or @location.expired?
      new
      @location.save! # assign an id to be presneted to the front end
      @@geocodejob.perform_later(id: @location.id, host: @location.host)
    end
  end

  # GET /locations
  # GET /locations.json
  def index
    @locations = Location.all
  end

  # GET /locations/1
  # GET /locations/1.json
  def show
  end

  # GET /locations/new
  def new
    @location = Location.new
    @location.host = src_addr_on_header
  end

  # GET /locations/1/edit
  def edit
  end

  # POST /locations
  # POST /locations.json
  def create
    @@geocodejob.perform_later(location_params)

    respond_to do |format|
      format.html { redirect_to locations_url, notice: 'Location was enqued.' }
      format.json { render :show, status: :ok } # FIXME
{'fraction_non_alphanumeric': 0.0978805394990366, 'fraction_numerical': 0.0023121387283236996, 'mean_word_length': 3.248772504091653, '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': '808443', 'n_tokens_mistral': 894, 'n_tokens_neox': 841, 'n_words': 220}