<commit_before>class WalksController < ActionController::Base
  def create
  	# user = User.find_by(id: session[:id])
    @walk = Walk.new(user_id: params[:user_id])
    # keeps user who created walk logged into walk until walk
    # is ended.
    if @walk.save
      # @walk.marks << Mark.create!(mark_params)

    session[:walk_id] = @walk.id

      if request.xhr?


  def show
    walk = Walk.find_by(id: params[:id])

        # redirect_to @walk
        render '_buttons'
      end
      redirect_to walk_path(@walk)
    else
      @errors = @walk.errors
      redirect_to :back
    end


    if walk
      features = Array.new
      puts walk.marks[0].longitude
      walk.marks.each do |mark|
         features << {
          type: "Feature",
          geometry: {
            type: "Point",
            coordinates: [mark.longitude.to_f, mark.latitude.to_f]
          },
          properties: {
            # name:
            # address:
            :"marker-color" => "#00607d",
            :"marker-symbol" => "circle",
            :"marker-size" => "medium"
          }
        }
      end

      geojson = {
        type: "FeatureCollection",
        features: features
      }

      puts geojson

      render json: geojson

    else
      render :nothing => true, status: 404
    end
  end
  # private
  #   def mark_params
  #     params.require(:mark).permit(:accuracy, :latitude, :longitude)
  #   end
end<commit_msg>fixed merge conflict<commit_after>class WalksController < ActionController::Base
  def create
    user = User.find_by(id: session[:id])
    @walk = Walk.create(user: user)
    # keeps user who created walk logged into walk until walk
    # is ended.
    @walk.marks << Mark.create!(mark_params)
    session[:walk_id] = @walk.id

    # redirect_to @walk
    render '_buttons'
  end

  def show
    walk = Walk.find_by(id: params[:id])

    if walk
      features = Array.new
      puts walk.marks[0].longitude
      walk.marks.each do |mark|
         features << {
          type: "Feature",
          geometry: {
            type: "Point",
            coordinates: [mark.longitude.to_f, mark.latitude.to_f]
          },
          properties: {
            # name:
            # address:
            :"marker-color" => "#00607d",
            :"marker-symbol" => "circle",
            :"marker-size" => "medium"
          }
        }
      end

      geojson = {
        type: "FeatureCollection",
        features: features
      }

      puts geojson

      render json: geojson

    else
      render :nothing => true, status: 404
    end
  end
end
{'fraction_non_alphanumeric': 0.1141640866873065, 'fraction_numerical': 0.00696594427244582, 'mean_word_length': 1.7885652642934196, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '802226', 'n_tokens_mistral': 809, 'n_tokens_neox': 770, 'n_words': 188}