From ff40d320288d7d558e58d9bda22a46dd6031fdca Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Thu, 18 Jan 2018 21:34:08 -0400 Subject: [PATCH] Add new filters to Admin::Budget::Investment navbar --- app/controllers/admin/budget_investments_controller.rb | 2 +- app/models/budget/investment.rb | 2 ++ config/locales/en/admin.yml | 2 ++ config/locales/es/admin.yml | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/budget_investments_controller.rb b/app/controllers/admin/budget_investments_controller.rb index eb2125aa1..2ad59159c 100644 --- a/app/controllers/admin/budget_investments_controller.rb +++ b/app/controllers/admin/budget_investments_controller.rb @@ -3,7 +3,7 @@ class Admin::BudgetInvestmentsController < Admin::BaseController include FeatureFlags feature_flag :budgets - has_filters(%w{without_admin valuation_finished all}, + has_filters(%w{all without_admin without_valuator under_valuation valuation_finished}, only: [:index, :toggle_selection]) before_action :load_budget diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb index 21cdab879..5534c7d00 100644 --- a/app/models/budget/investment.rb +++ b/app/models/budget/investment.rb @@ -53,6 +53,8 @@ class Budget scope :valuation_open, -> { where(valuation_finished: false) } scope :without_admin, -> { valuation_open.where(administrator_id: nil) } + scope :without_valuator, -> { valuation_open.where(valuator_assignments_count: 0) } + scope :under_valuation, -> { valuation_open.where("valuator_assignments_count > 0 AND administrator_id IS NOT ?", nil) } scope :managed, -> { valuation_open.where(valuator_assignments_count: 0).where("administrator_id IS NOT ?", nil) } scope :valuating, -> { valuation_open.where("valuator_assignments_count > 0") } scope :valuation_finished, -> { where(valuation_finished: true) } diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index d277508c7..fd62030ee 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -140,6 +140,8 @@ en: filters: all: All without_admin: Without assigned admin + without_valuator: Without assigned valuator + under_valuation: Under valuation valuation_finished: Valuation finished feasible: Feasible selected: Selected diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index ae5abc502..907fd251f 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -140,6 +140,8 @@ es: filters: all: Todos without_admin: Sin administrador + without_valuator: Sin evaluador + under_valuation: En evaluación valuation_finished: Evaluación finalizada feasible: Viables selected: Seleccionados