diff --git a/app/models/order.rb b/app/models/order.rb index 48834f9..696197a 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -5,6 +5,7 @@ class Order < ActiveRecord::Base before_validation :generate_uuid!, :on => :create belongs_to :user belongs_to :payment_option + scope :completed, where("token != ? OR token != ?", "", nil) self.primary_key = 'uuid' # This is where we create our Caller Reference for Amazon Payments, and prefill some other information. @@ -66,13 +67,15 @@ class Order < ActiveRecord::Base # See what it looks like when you have some backers! Drop in a number instead of Order.count def self.backers - Order.where("token != ? OR token != ?", "", nil).count + Order.completed.count end def self.revenue - revenue = PaymentOption.joins(:orders).where("token != ? OR token != ?", "", nil).pluck('sum(amount)')[0] - return 0 if revenue.nil? - revenue + if Settings.use_payment_options + PaymentOption.joins(:orders).where("token != ? OR token != ?", "", nil).pluck('sum(amount)')[0].to_f + else + Order.completed.sum(:price).to_f + end end validates_presence_of :name, :price, :user_id diff --git a/config/settings.yml b/config/settings.yml index 3f9954d..1d15aac 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -14,14 +14,14 @@ project_goal: 100000 # This'll be both the page title () and the name in the header product_name: "Selfstarter" -# This will be used in sentences like Hooray Youve just reserved product_description +# This will be used in sentences like Hooray You've just reserved product_description product_description: "a set of widgets" # An image showcasing your product -- it'll show up when you pin your product # It should be in app/assets/images product_image_path: "my-product-image.png" -# The message on the preorder page, Lockitron's +# The message on the preorder page, Lockitron's is "" value_proposition: "Roll your own crowdfunding" # YouTube or Vimeo Video URL (The embed URL, without the query string options) @@ -58,7 +58,7 @@ charge_limit: 25.00 # On Lockitron, it's "backers" primary_stat: "backers" -# This'll show up in the tweet as, "I'm forker number ..." +# This'll show up in the tweet as, "I'm backer number ..." primary_stat_verb: 'backer' # The 2nd call to action button, towards the middle-ish of the page