<commit_before># encoding: utf-8
class Meal < ActiveRecord::Base
  has_and_belongs_to_many :users
  has_many :orders

  def total_cost
    total = 0.0
    orders.each do |o|
      total += o.cost
    end
    return total
  end

  def total_owing
    owing = 0.0
    orders.each do |o|
      owing += o.cost unless o.has_paid?
    end
    return owing
  end

  def generate_summary!
    same_orders = {}
    orders.each do |o|
      key = o.description.nil? ? nil : o.description.downcase
      same_orders[key] ||= {:actual => nil, :count => 0}
      same_orders[key][:count] += 1
      same_orders[key][:actual] ||= o.description<commit_msg>sorting requires a string to compare<commit_after># encoding: utf-8
class Meal < ActiveRecord::Base
  has_and_belongs_to_many :users
  has_many :orders

  def total_cost
    total = 0.0
    orders.each do |o|
      total += o.cost
    end
    return total
  end

  def total_owing
    owing = 0.0
    orders.each do |o|
      owing += o.cost unless o.has_paid?
    end
    return owing
  end

  def generate_summary!
    same_orders = {}
    orders.each do |o|
      key = o.description.nil? ? '' : o.description.downcase
      same_orders[key] ||= {:actual => nil, :count => 0}
      same_orders[key][:count] += 1
      same_orders[key][:actual] ||= o.description
{'fraction_non_alphanumeric': 0.11485451761102604, 'fraction_numerical': 0.010719754977029096, 'mean_word_length': 2.610497237569061, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4395258', 'n_tokens_mistral': 469, 'n_tokens_neox': 446, 'n_words': 117}