Merge branch 'budgets-baltasar' of github.com:consul/consul into budgets-baltasar

This commit is contained in:
Alberto Garcia Cabeza
2017-01-05 17:50:28 +01:00
3 changed files with 34 additions and 1 deletions

View File

@@ -17,7 +17,7 @@ module Budgets
feature_flag :budgets
has_orders %w{most_voted newest oldest}, only: :show
has_orders ->(c){ c.instance_variable_get(:@budget).balloting? ? %w{random price} : %w{random confidence_score} }, only: :index
has_orders ->(c) { c.instance_variable_get(:@budget).investments_orders }, only: :index
invisible_captcha only: [:create, :update], honeypot: :subtitle, scope: :budget_investment

View File

@@ -94,6 +94,17 @@ class Budget < ActiveRecord::Base
formatted_amount(amount_spent(heading))
end
def investments_orders
case phase
when 'accepting', 'reviewing'
%w{random}
when 'balloting', 'reviewing_ballots'
%w{random price}
else
%w{random confidence_score}
end
end
private
def sanitize_descriptions