<commit_before>class EventsController < ApplicationController

  def index
    @user = User.find(params[:user_id])
    event = Event.featured_events(@user.interests_ids, @user.city, @user.wishlist_ids).limit(1)[0]
    render json: {user: @user, event: event, categories: Category.all}
  end

  def list
    @user = User.find(params[:user_id])
    events = Event.featured_events(@user.interests_ids, @user.city, @user.wishlist_ids).limit(20)
    render json: {user: @user, events: events}
  end

  def all
    @event = Event.all.sample
    @events = Event.all

    render json: {event: @event, events: @events}
  end

  def show
    @event = Event.find(params[:id])

    render json: {event: @event}
  end

end<commit_msg>make events sample rather than limit, this allows us to get randomly generated events rather than alphabetical<commit_after>class EventsController < ApplicationController

  def index
    @user = User.find(params[:user_id])
    event = Event.featured_events(@user.interests_ids, @user.city, @user.wishlist_ids).sample
    render json: {user: @user, event: event, categories: Category.all}
  end

  def list
    @user = User.find(params[:user_id])
    events = Event.featured_events(@user.interests_ids, @user.city, @user.wishlist_ids).limit(20)
    render json: {user: @user, events: events}
  end

  def all
    @event = Event.all.sample
    @events = Event.all

    render json: {event: @event, events: @events}
  end

  def show
    @event = Event.find(params[:id])

    render json: {event: @event}
  end

end
{'fraction_non_alphanumeric': 0.12451108213820078, 'fraction_numerical': 0.003911342894393742, 'mean_word_length': 3.873015873015873, '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': '2538849', 'n_tokens_mistral': 515, 'n_tokens_neox': 499, 'n_words': 131}