Skip to content

Commit

Permalink
Fixed bug in progress bar when not using PaymentOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed Jan 30, 2013
1 parent cc4adb2 commit da2d021
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions app/models/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -66,13 +67,15 @@ def self.percent

# 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
Expand Down
6 changes: 3 additions & 3 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ project_goal: 100000
# This'll be both the page title (<title></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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit da2d021

Please sign in to comment.