adds new filters to admin valuations
This commit is contained in:
@@ -2,7 +2,7 @@ class Admin::SpendingProposalsController < Admin::BaseController
|
||||
include FeatureFlags
|
||||
feature_flag :spending_proposals
|
||||
|
||||
has_filters %w{all without_admin without_valuators valuating valuation_finished}, only: :index
|
||||
has_filters %w{valuation_open without_admin managed valuating valuation_finished}, only: :index
|
||||
|
||||
load_and_authorize_resource
|
||||
|
||||
@@ -26,5 +26,4 @@ class Admin::SpendingProposalsController < Admin::BaseController
|
||||
@spending_proposal.update(params.require(:spending_proposal).permit(valuator_ids: []))
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -18,9 +18,10 @@ class SpendingProposal < ActiveRecord::Base
|
||||
validates :description, length: { maximum: SpendingProposal.description_max_length }
|
||||
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
|
||||
|
||||
scope :without_admin, -> { where(administrator_id: nil) }
|
||||
scope :without_valuators, -> { where(valuation_assignments_count: 0) }
|
||||
scope :valuating, -> { where("valuation_assignments_count > 0 AND valuation_finished = ?", false) }
|
||||
scope :valuation_open, -> { where(valuation_finished: false) }
|
||||
scope :without_admin, -> { valuation_open.where(administrator_id: nil) }
|
||||
scope :managed, -> { valuation_open.where(valuation_assignments_count: 0).where("administrator_id IS NOT ?", nil) }
|
||||
scope :valuating, -> { valuation_open.where("valuation_assignments_count > 0 AND valuation_finished = ?", false) }
|
||||
scope :valuation_finished, -> { where(valuation_finished: true) }
|
||||
|
||||
scope :for_render, -> { includes(:geozone, administrator: :user, valuators: :user) }
|
||||
|
||||
Reference in New Issue
Block a user