<commit_before>class HomepagesController < ApplicationController
  def index
  end

  def getPotholes
    @holes = Pothole.where('"potholes"."creation_date" IN (?) OR "potholes"."completion_date" IN (?)', params[:all_dates], params[:all_dates])
    respond_to do |format|
      format.html
      format.json { render :json => @holes }
    end
  end


  def renderReport
  end

  def submitReport


    uri = URI.parse('http://test311request.cityofchicago.org/open311/v2/requests.json')
    api_key = ENV["open311_key"]

    http = Net::HTTP.new(uri.host, uri.port)
    request = Net::HTTP::Post.new(uri.request_uri)
    request.set_form_data({'api_key' => api_key,
                           'service_code'=> '4fd3b656e750846c53000004',
                           'lat' => params["latitude"],
                           'long' => params["longitude"],
                           'address_string' => params["address"],
                           'description' => params["description"],
                           'attribute[WHEREIST]' => params["attribute"],
                           'phone' => params["phone"],
                           'media_url' => params["mediaUrl"]})

    response = http.request(request)
    msg = response.body
    token = JSON.parse(msg).pop["token"]
    respond_to do |format|
      format.json {
        render :json => {msg: token}
      }
    end
  end

<commit_msg>route for upload photo to s3<commit_after>class HomepagesController < ApplicationController
  def index
  end

  def getPotholes
    @holes = Pothole.where('"potholes"."creation_date" IN (?) OR "potholes"."completion_date" IN (?)', params[:all_dates], params[:all_dates])
    respond_to do |format|
      format.html
      format.json { render :json => @holes }
    end
  end


  def renderReport
  end

  def submitReport


    uri = URI.parse('http://test311request.cityofchicago.org/open311/v2/requests.json')
    api_key = ENV["open311_key"]

    http = Net::HTTP.new(uri.host, uri.port)
    request = Net::HTTP::Post.new(uri.request_uri)
    request.set_form_data({'api_key' => api_key,
                           'service_code'=> '4fd3b656e750846c53000004',
                           'lat' => params["latitude"],
                           'long' => params["longitude"],
                           'address_string' => params["address"],
                           'description' => params["description"],
                           'attribute[WHEREIST]' => params["attribute"],
                           'phone' => params["phone"],
                           'media_url' => params["mediaUrl"]})

    response = http.request(request)
    msg = response.body
    token = JSON.parse(msg).pop["token"]
    respond_to do |format|
      format.json {
        render :json => {msg: token}
      }
    end
  end
  
  def uploadToS3
    @photo = Photo.new(photo_params)
    respond_to do |format|
      if @photo.save
        format.html 
        format.json { render :json => { url: @photo.url.medium } }
      else
        format.html 
        format.json { render :json => { url: 'none'} }
      end
    end
  end
  
  private

  def photo_params
      params.require(:photo).permit(:url)
  end


{'fraction_non_alphanumeric': 0.13212273011897308, 'fraction_numerical': 0.01878522229179712, 'mean_word_length': 2.069164265129683, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '2542903', 'n_tokens_mistral': 1007, 'n_tokens_neox': 938, 'n_words': 183}