<commit_before>class ToursController < ApiController
  before_action :authenticate_user!

  def index
    render json: current_user.tours.order("published ASC, created_at DESC")
  end

  def search
    tours = Tour.published.filters(params).search(params[:query])

    render json: { total: tours.count(:all), tours: Kaminari.paginate_array(tours).page(params[:page]).per(10) }
  end

  def show
    tour = current_user.tours.find(params[:id])

    render json: tour, full: true
  end

  def start
    tour = current_user.tours.find(params[:id])

    render json: tour.get_directions("#{params[:latitude].to_f},#{params[:longitude].to_f}")
  end

  def create
    tour = current_user.tours.new(tour_params)

    if tour.save
      render json: tour<commit_msg>Tour.show() should pull from any tour<commit_after>class ToursController < ApiController
  before_action :authenticate_user!

  def index
    render json: current_user.tours.order("published ASC, created_at DESC")
  end

  def search
    tours = Tour.published.filters(params).search(params[:query])

    render json: { total: tours.count(:all), tours: Kaminari.paginate_array(tours).page(params[:page]).per(10) }
  end

  def show
    tour = Tour.find(params[:id])

    render json: tour, full: true
  end

  def start
    tour = current_user.tours.find(params[:id])

    render json: tour.get_directions("#{params[:latitude].to_f},#{params[:longitude].to_f}")
  end

  def create
    tour = current_user.tours.new(tour_params)

    if tour.save
      render json: tour
{'fraction_non_alphanumeric': 0.12418300653594772, 'fraction_numerical': 0.00261437908496732, 'mean_word_length': 4.069536423841059, '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': '3379857', 'n_tokens_mistral': 517, 'n_tokens_neox': 495, 'n_words': 108}