diff --git a/app/controllers/valuation/budgets_controller.rb b/app/controllers/valuation/budgets_controller.rb
index 9789ab929..338cccec4 100644
--- a/app/controllers/valuation/budgets_controller.rb
+++ b/app/controllers/valuation/budgets_controller.rb
@@ -7,11 +7,9 @@ class Valuation::BudgetsController < Valuation::BaseController
def index
@budget = current_budget
if @budget.present?
- @investments_with_valuation_open = {}
- @investments_with_valuation_open = @budget.investments
- .by_valuator(current_user.valuator.try(:id))
- .valuation_open
- .count
+ @investments = @budget.investments
+ .by_valuator(current_user.valuator)
+ .valuation_open
end
end
end
diff --git a/app/views/valuation/budgets/index.html.erb b/app/views/valuation/budgets/index.html.erb
index f1fd302b6..1e98cf23e 100644
--- a/app/views/valuation/budgets/index.html.erb
+++ b/app/views/valuation/budgets/index.html.erb
@@ -1,30 +1,36 @@
<%= t("valuation.budgets.index.title") %>
-
-
-
- | <%= t("valuation.budgets.index.table_name") %> |
- <%= t("valuation.budgets.index.table_phase") %> |
- <%= t("valuation.budgets.index.table_assigned_investments_valuation_open") %> |
- <%= t("valuation.budgets.index.table_actions") %> |
-
-
-
-
- |
- <%= @budget.name %>
- |
-
- <%= t("budgets.phase.#{@budget.phase}") %>
- |
-
- <%= @investments_with_valuation_open %>
- |
-
- <%= link_to t("valuation.budgets.index.evaluate"),
- valuation_budget_budget_investments_path(budget_id: @budget.id),
- class: "button hollow expanded" %>
- |
-
-
-
+<% if @budget.present? %>
+
+
+
+ | <%= t("valuation.budgets.index.table_name") %> |
+ <%= t("valuation.budgets.index.table_phase") %> |
+ <%= t("valuation.budgets.index.table_assigned_investments_valuation_open") %> |
+ <%= t("valuation.budgets.index.table_actions") %> |
+
+
+
+
+ |
+ <%= @budget.name %>
+ |
+
+ <%= t("budgets.phase.#{@budget.phase}") %>
+ |
+
+ <%= @investments.count %>
+ |
+
+ <%= link_to t("valuation.budgets.index.evaluate"),
+ valuation_budget_budget_investments_path(budget_id: @budget.id),
+ class: "button hollow expanded" %>
+ |
+
+
+
+<% else %>
+
+ <%= t("valuation.budgets.index.no_budgets") %>
+
+<% end %>
diff --git a/config/locales/en/valuation.yml b/config/locales/en/valuation.yml
index 116a86c5a..b918020af 100644
--- a/config/locales/en/valuation.yml
+++ b/config/locales/en/valuation.yml
@@ -17,6 +17,7 @@ en:
table_assigned_investments_valuation_open: Investment projects assigned with valuation open
table_actions: Actions
evaluate: Evaluate
+ no_budgets: "There are no budgets"
budget_investments:
index:
headings_filter_all: All headings
diff --git a/config/locales/es/valuation.yml b/config/locales/es/valuation.yml
index f762260b2..a0b36182f 100644
--- a/config/locales/es/valuation.yml
+++ b/config/locales/es/valuation.yml
@@ -17,6 +17,7 @@ es:
table_assigned_investments_valuation_open: Prop. Inv. asignadas en evaluación
table_actions: Acciones
evaluate: Evaluar
+ no_budgets: "No hay presupuestos"
budget_investments:
index:
headings_filter_all: Todas las partidas
diff --git a/spec/features/valuation/budgets_spec.rb b/spec/features/valuation/budgets_spec.rb
index 9057f81d3..ac8e79ab3 100644
--- a/spec/features/valuation/budgets_spec.rb
+++ b/spec/features/valuation/budgets_spec.rb
@@ -35,6 +35,11 @@ feature 'Valuation budgets' do
expect(page).to have_content(budget3.name)
end
+ scenario "With no budgets" do
+ visit valuation_budgets_path
+
+ expect(page).to have_content "There are no budgets"
+ end
end
end