<commit_before>module Voteable
  def downvote(user)
    @_vote = find_vote(user)
    @_vote.value = false
  end

  def upvote(user)
    @_vote = find_vote(user)
    @_vote.value = true
  end

  def time_since_creation
    hours_number = ((Time.now - created_at) / 3600).round
    "#{hours_number} hours ago"
  end

  def parent_question_id
    case Module.get_const(self.get_type)
    when Question
      return self.id
    when Answer<commit_msg>Define get_score method in Voteable module<commit_after>module Voteable
  def downvote(user)
    @_vote = find_vote(user)
    @_vote.value = false
  end

  def upvote(user)
    @_vote = find_vote(user)
    @_vote.value = true
  end

  def time_since_creation
    hours_number = ((Time.now - created_at) / 3600).round
    "#{hours_number} hours ago"
  end

  def get_score
    all_votes = self.votes
    all_votes.reduce(0) do  |sum, vote|
      sum += 1 if vote.value
      sum -= 1 if !vote.value
      sum
    end
  end

  def parent_question_id
    case Module.get_const(self.get_type)
    when Question
      return self.id
    when Answer
{'fraction_non_alphanumeric': 0.0871559633027523, 'fraction_numerical': 0.010091743119266056, 'mean_word_length': 2.7750865051903113, 'pattern_counts': {'":': 0, '<': 3, '<?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': '316826', 'n_tokens_mistral': 403, 'n_tokens_neox': 381, 'n_words': 95}