<commit_before>class Game < ActiveRecord::Base

  STATUS = {:open => 'open', :active => 'active', :old => 'old'}

  has_one :board, :dependent => :destroy
  has_many :initiatives, -> { order(:sort_order) }, :dependent => :destroy
  belongs_to :user

  validates :board, :presence => true
  validates :name, :presence => true

  def background_image
    board ? board.background_image : nil
  end

  def background_image=(val)
    if board
      board.background_image = val
    end
  end

  def is_owner(current_user_id)
    puts "==============="
    puts current_user_id
    puts self.user_id
    puts current_user_id == self.user_id
    current_user_id == self.user_id
  end

  def as_json(options = {})
    {
        :name => name,
        :status => status,
        :is_owner => is_owner(options[:current_user_id]),
        :board => board.as_json(options.slice(:image_callback)),
        :initiative => initiatives.to_a.map { |i| {:name => i.name, :value => i.value} }
    }<commit_msg>Removed debug statements<commit_after>class Game < ActiveRecord::Base

  STATUS = {:open => 'open', :active => 'active', :old => 'old'}

  has_one :board, :dependent => :destroy
  has_many :initiatives, -> { order(:sort_order) }, :dependent => :destroy
  belongs_to :user

  validates :board, :presence => true
  validates :name, :presence => true

  def background_image
    board ? board.background_image : nil
  end

  def background_image=(val)
    if board
      board.background_image = val
    end
  end

  def is_owner(current_user_id)
    current_user_id == self.user_id
  end

  def as_json(options = {})
    {
        :name => name,
        :status => status,
        :is_owner => is_owner(options[:current_user_id]),
        :board => board.as_json(options.slice(:image_callback)),
        :initiative => initiatives.to_a.map { |i| {:name => i.name, :value => i.value} }
    }
{'fraction_non_alphanumeric': 0.14414893617021277, 'fraction_numerical': 0.0, 'mean_word_length': 3.2460496613995486, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, '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': '2050721', 'n_tokens_mistral': 625, 'n_tokens_neox': 610, 'n_words': 140}