Skip to content

Instantly share code, notes, and snippets.

@oleander
Created July 5, 2011 08:03
Show Gist options
  • Select an option

  • Save oleander/1064443 to your computer and use it in GitHub Desktop.

Select an option

Save oleander/1064443 to your computer and use it in GitHub Desktop.
pop_user # The pop user
book_payments.each do |payment|
book = payment.order.book_purchase.book
authors = [book.author] + book.co_authors
authors.each do |author|
batch.add_amount(author.id, (1 - book.charity_percentage) * author_part(payment.amount.to_f/authors.size.to_f) )
batch.add_amount(pop_user.id, book.charity_percentage * author_part(payment.amount.to_f/authors.size.to_f) )
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment