<commit_before>class CitiesController < ApplicationController

  def create

    @user = User.find(session[:user_id]) if session[:user_id]
    @city = City.find_or_create_by(lat: city_params[:lat], lon: city_params[:lon]) do |city| 
      city.name = city_params[:name] 
      city.bigger_thing = city_params[:bigger_thing] 
      city.country = city_params[:country] 
    end
   
    unless @user.cities.find_by(lat: city_params[:lat], lon: city_params[:lon])
      @user.cities << @city if @user
      del_city_id = city_params[:lastClock].to_i
      CityUser.find_by(user_id: @user.id, city_id: del_city_id).destroy if @user
      render json: @city
    else
      render json: "this city already exists".to_json
    end
      
  end

  def get_city
    @user = User.find(session[:user_id]) if session[:user_id] 
    if @user != nil
      @user_info = { <commit_msg>Reverts temp updates to cities_controller.rb<commit_after>class CitiesController < ApplicationController

  def create

    @user = User.find(session[:user_id]) if session[:user_id]
    @city = City.find_or_create_by(lat: city_params[:lat], lon: city_params[:lon]) do |city| 
      city.name = city_params[:name] 
      city.bigger_thing = city_params[:bigger_thing] 
      city.country = city_params[:country] 
    end
   
    unless @user.cities.find_by(lat: city_params[:lat], lon: city_params[:lon])
      @user.cities << @city
      del_city_id = city_params[:lastClock].to_i
      CityUser.find_by(user_id: @user.id, city_id: del_city_id).destroy   
      render json: @city
    else
      render json: "this city already exists".to_json
    end
      
  end

  def get_city
    @user = User.find(session[:user_id]) if session[:user_id] 
    if @user != nil
      @user_info = { 
{'fraction_non_alphanumeric': 0.11801596351197263, 'fraction_numerical': 0.0, 'mean_word_length': 3.3548387096774195, 'pattern_counts': {'":': 0, '<': 9, '<?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': '1195174', 'n_tokens_mistral': 603, 'n_tokens_neox': 584, 'n_words': 124}