Created
July 6, 2015 18:03
-
-
Save imouaddine/767fb55b14f51fd27208 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
csv do | |
column 'credit id' do |credit| | |
credit.id.to_s | |
end | |
column "account id" do |credit| | |
credit.account_id.to_s | |
end | |
column('enterprise') { |c| c.account && (c.account.enterprise? ? 'yes' : '') || '' } | |
column "client id" do |credit| | |
credit.user && credit.user.id.to_s || 'no user' | |
end | |
column 'client name' do |credit| | |
credit.user && credit.user.display_name || 'no user' | |
end | |
column 'email' do |credit| | |
credit.user && credit.user.email || 'no user' | |
end | |
column "credit type" do |credit| | |
credit.source | |
end | |
column "orig. credits" do |credit| | |
credit.original_value.to_s | |
end | |
column "credits spent" do |credit| | |
credit.value_spent | |
end | |
column 'price per test' do |credit| | |
credit.price_per_test | |
end | |
column "remaining $ value" do |credit| | |
(credit.price_per_test * (credit.original_value - credit.value_spent)).to_s | |
end | |
column :created_at | |
column :expiration_date | |
column :notes | |
column 'order id' do |credit| | |
credit.try(:order).try(:id).to_s | |
end | |
column 'order completed at' do |credit| | |
credit.try(:order).try(:completed_at).to_s | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment