Add visible_to_valuators and author username to admin investments CSV

Backport based on 012e4be by María Checa from AyuntamientoMadrid/consul fork
This commit is contained in:
Marko Lovic
2018-07-25 15:10:56 +02:00
parent 5413c34458
commit 601e3058d8
4 changed files with 17 additions and 8 deletions

View File

@@ -25,7 +25,9 @@ class Budget::Investment::Exporter
I18n.t("admin.budget_investments.index.list.geozone"), I18n.t("admin.budget_investments.index.list.geozone"),
I18n.t("admin.budget_investments.index.list.feasibility"), I18n.t("admin.budget_investments.index.list.feasibility"),
I18n.t("admin.budget_investments.index.list.valuation_finished"), I18n.t("admin.budget_investments.index.list.valuation_finished"),
I18n.t("admin.budget_investments.index.list.selected") I18n.t("admin.budget_investments.index.list.selected"),
I18n.t("admin.budget_investments.index.list.visible_to_valuators"),
I18n.t("admin.budget_investments.index.list.author_username")
] ]
end end
@@ -40,7 +42,9 @@ class Budget::Investment::Exporter
investment.heading.name, investment.heading.name,
price(investment), price(investment),
investment.valuation_finished? ? I18n.t('shared.yes') : I18n.t('shared.no'), investment.valuation_finished? ? I18n.t('shared.yes') : I18n.t('shared.no'),
investment.selected? ? I18n.t('shared.yes') : I18n.t('shared.no') investment.selected? ? I18n.t('shared.yes') : I18n.t('shared.no'),
investment.visible_to_valuators? ? I18n.t('shared.yes') : I18n.t('shared.no'),
investment.author.username
] ]
end end

View File

@@ -199,6 +199,7 @@ en:
valuation_finished: Val. Fin. valuation_finished: Val. Fin.
selected: Selected selected: Selected
visible_to_valuators: Show to valuators visible_to_valuators: Show to valuators
author_username: Author username
incompatible: Incompatible incompatible: Incompatible
cannot_calculate_winners: The budget has to stay on phase "Balloting projects", "Reviewing Ballots" or "Finished budget" in order to calculate winners projects cannot_calculate_winners: The budget has to stay on phase "Balloting projects", "Reviewing Ballots" or "Finished budget" in order to calculate winners projects
see_results: "See results" see_results: "See results"

View File

@@ -199,6 +199,7 @@ es:
valuation_finished: Ev. Fin. valuation_finished: Ev. Fin.
selected: Seleccionado selected: Seleccionado
visible_to_valuators: Mostrar a evaluadores visible_to_valuators: Mostrar a evaluadores
author_username: Usuario autor
incompatible: Incompatible incompatible: Incompatible
cannot_calculate_winners: El presupuesto debe estar en las fases "Votación final", "Votación finalizada" o "Resultados" para poder calcular las propuestas ganadoras cannot_calculate_winners: El presupuesto debe estar en las fases "Votación final", "Votación finalizada" o "Resultados" para poder calcular las propuestas ganadoras
see_results: "Ver resultados" see_results: "Ver resultados"

View File

@@ -1060,13 +1060,15 @@ feature 'Admin budget investments' do
cached_votes_up: 88, price: 99, cached_votes_up: 88, price: 99,
valuators: [], valuators: [],
valuator_groups: [valuator_group], valuator_groups: [valuator_group],
administrator: admin) administrator: admin,
visible_to_valuators: true)
second_investment = create(:budget_investment, :unfeasible, title: "Alt Investment", second_investment = create(:budget_investment, :unfeasible, title: "Alt Investment",
budget: budget, group: budget_group, budget: budget, group: budget_group,
heading: second_budget_heading, heading: second_budget_heading,
cached_votes_up: 66, price: 88, cached_votes_up: 66, price: 88,
valuators: [valuator], valuators: [valuator],
valuator_groups: []) valuator_groups: [],
visible_to_valuators: false)
visit admin_budget_budget_investments_path(budget) visit admin_budget_budget_investments_path(budget)
@@ -1077,10 +1079,11 @@ feature 'Admin budget investments' do
expect(header).to match(/filename="budget_investments.csv"$/) expect(header).to match(/filename="budget_investments.csv"$/)
csv_contents = "ID,Title,Supports,Administrator,Valuator,Valuation Group,Scope of operation,"\ csv_contents = "ID,Title,Supports,Administrator,Valuator,Valuation Group,Scope of operation,"\
"Feasibility,Val. Fin.,Selected\n#{first_investment.id},Le Investment,88,"\ "Feasibility,Val. Fin.,Selected,Show to valuators,Author username\n"\
"Admin,-,Valuator Group,Budget Heading,Feasible (€99),Yes,Yes\n"\ "#{first_investment.id},Le Investment,88,Admin,-,Valuator Group,"\
"#{second_investment.id},Alt Investment,66,No admin assigned,Valuator,-,"\ "Budget Heading,Feasible (€99),Yes,Yes,Yes,#{first_investment.author.username}\n#{second_investment.id},"\
"Other Heading,Unfeasible,No,No\n" "Alt Investment,66,No admin assigned,Valuator,-,Other Heading,"\
"Unfeasible,No,No,No,#{second_investment.author.username}\n"
expect(page.body).to eq(csv_contents) expect(page.body).to eq(csv_contents)
end end