<commit_before>class LocationController < ApplicationController

  # GET /es/location/change
  def ask
    # show form for asking possible locations
    @location_suggest = get_location_suggest
  end

  # POST /es/location/change
  # GET /es/location/change2?location=:location
  def list
    # list possible locations 
    @location_suggest = get_location_suggest
    if params[:location]
      locations = WoeidHelper.search_by_name params[:location]
      if not locations.nil? and locations.count == 1
        set_location locations[0]
      else
        @location_asked = locations
      end
    end
  end

  # POST /es/location/change2
  def change
    if params[:location].to_i == 0 
      locations = WoeidHelper.search_by_name params[:location]
      if locations 
        set_location locations[0][1]
      else
        redirect_to location_ask_path, alert: "Hubo un error con el cambio de su ubicación. Inténtelo de nuevo."
      end
    else
      set_location params[:location]
    end
  end

  private<commit_msg>[location] fix Mysql​2::Er​ror: ​Colum​n 'wo​eid' ​canno​t be ​null on Albacete<commit_after>class LocationController < ApplicationController

  # GET /es/location/change
  def ask
    # show form for asking possible locations
    @location_suggest = get_location_suggest
  end

  # POST /es/location/change
  # GET /es/location/change2?location=:location
  def list
    # list possible locations 
    @location_suggest = get_location_suggest
    if params[:location]
      locations = WoeidHelper.search_by_name params[:location]
      if not locations.nil? and locations.count == 1
        set_location locations[0][1]
      else
        @location_asked = locations
      end
    end
  end

  # POST /es/location/change2
  def change
    if params[:location].to_i == 0 
      locations = WoeidHelper.search_by_name params[:location]
      if locations 
        set_location locations[0][1]
      else
        redirect_to location_ask_path, alert: "Hubo un error con el cambio de su ubicación. Inténtelo de nuevo."
      end
    else
      set_location params[:location]
    end
  end

  private
{'fraction_non_alphanumeric': 0.07395195478097033, 'fraction_numerical': 0.007536504945831371, 'mean_word_length': 2.918819188191882, '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': '6423630', 'n_tokens_mistral': 649, 'n_tokens_neox': 620, 'n_words': 174}