Add missing event name translations
We were always displaying the event names in English. Note we're changing the `user_supported_budgets` key because it didn't make much sense; the investments are supported, and not the budgets. We're also adding "created" to most of the event names in order to make the texts more explicit, since not all the events refer to created data.
This commit is contained in:
@@ -30,6 +30,6 @@ class Admin::Stats::BudgetSupportingComponent < ApplicationComponent
|
||||
end
|
||||
|
||||
def chart
|
||||
@chart ||= Ahoy::Chart.new("user_supported_budgets")
|
||||
@chart ||= Ahoy::Chart.new("budget_investment_supported")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,18 +31,14 @@ module Ahoy
|
||||
end
|
||||
|
||||
def title
|
||||
text = t("admin.stats.graph.#{event_name}")
|
||||
if text.to_s.match(/translation missing/)
|
||||
text = event_name.to_s.titleize
|
||||
end
|
||||
text
|
||||
t("admin.stats.graph.#{event_name}")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def records
|
||||
case event_name.to_sym
|
||||
when :user_supported_budgets
|
||||
when :budget_investment_supported
|
||||
Vote.where(votable_type: "Budget::Investment")
|
||||
when :visits
|
||||
Visit.all
|
||||
|
||||
@@ -1488,11 +1488,14 @@ en:
|
||||
sdg: SDG
|
||||
graph:
|
||||
budget_investment_created: Budget investments created
|
||||
debate_created: Debates
|
||||
visit: Visits
|
||||
level_3_user: Level 3 users
|
||||
proposal_created: Citizen proposals
|
||||
budget_investment_supported: Budget investments supported
|
||||
debate_created: Debates created
|
||||
legislation_annotation_created: Legislation annotations created
|
||||
legislation_answer_created: Legislation answers created
|
||||
level_3_user: Level 3 users verified
|
||||
proposal_created: Citizen proposals created
|
||||
title: Graphs
|
||||
visits: Visits
|
||||
budgets:
|
||||
no_data_before_balloting_phase: "There isn't any data to show before the balloting phase."
|
||||
title: "Participatory Budgets - Participation stats"
|
||||
|
||||
@@ -1488,11 +1488,14 @@ es:
|
||||
sdg: ODS
|
||||
graph:
|
||||
budget_investment_created: Proyectos de gasto creados
|
||||
debate_created: Debates
|
||||
visit: Visitas
|
||||
level_3_user: Usuarios nivel 3
|
||||
proposal_created: Propuestas Ciudadanas
|
||||
budget_investment_supported: Proyectos de gasto apoyados
|
||||
debate_created: Debates creados
|
||||
legislation_annotation_created: Anotaciones creadas
|
||||
legislation_answer_created: Repuestas de legislación colaborativa creadas
|
||||
level_3_user: Usuarios de nivel 3 verificados
|
||||
proposal_created: Propuestas Ciudadanas creadas
|
||||
title: Gráficos
|
||||
visit: Visitas
|
||||
budgets:
|
||||
no_data_before_balloting_phase: "No hay datos que mostrar hasta que la fase de votación no esté abierta."
|
||||
title: "Presupuestos participativos - Estadisticas de participación"
|
||||
|
||||
@@ -10,8 +10,8 @@ describe Admin::Stats::EventLinksComponent do
|
||||
expect(page).to have_link count: 2
|
||||
|
||||
page.find("ul") do |list|
|
||||
expect(list).to have_link "Legislation Annotation Created"
|
||||
expect(list).to have_link "Legislation Answer Created"
|
||||
expect(list).to have_link "Legislation annotations created"
|
||||
expect(list).to have_link "Legislation answers created"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ describe Admin::Api::StatsController, :admin do
|
||||
get :show, params: { event: "proposal_created" }
|
||||
|
||||
expect(response).to be_ok
|
||||
expect(response.parsed_body).to eq "x" => ["2015-01-01", "2015-01-02"], "Citizen proposals" => [2, 1]
|
||||
expect(response.parsed_body).to eq "x" => ["2015-01-01", "2015-01-02"], "Citizen proposals created" => [2, 1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,7 +21,8 @@ describe Ahoy::Chart do
|
||||
|
||||
chart = Ahoy::Chart.new(:proposal_created)
|
||||
|
||||
expect(chart.data_points).to eq x: ["2015-01-01", "2015-01-02"], "Citizen proposals" => [2, 1]
|
||||
expect(chart.data_points).to eq x: ["2015-01-01", "2015-01-02"],
|
||||
"Citizen proposals created" => [2, 1]
|
||||
end
|
||||
|
||||
it "accepts strings as the event name" do
|
||||
@@ -30,7 +31,7 @@ describe Ahoy::Chart do
|
||||
|
||||
chart = Ahoy::Chart.new("proposal_created")
|
||||
|
||||
expect(chart.data_points).to eq x: ["2015-01-01"], "Citizen proposals" => [1]
|
||||
expect(chart.data_points).to eq x: ["2015-01-01"], "Citizen proposals created" => [1]
|
||||
end
|
||||
|
||||
it "returns visits data for the visits event" do
|
||||
@@ -46,7 +47,7 @@ describe Ahoy::Chart do
|
||||
expect(chart.data_points).to eq x: ["2015-01-01", "2015-01-02"], "Visits" => [2, 1]
|
||||
end
|
||||
|
||||
it "returns user supports for the user_supported_budgets event" do
|
||||
it "returns user supports for the budget_investment_supported event" do
|
||||
time_1 = Time.zone.local(2017, 04, 01)
|
||||
time_2 = Time.zone.local(2017, 04, 02)
|
||||
|
||||
@@ -55,9 +56,10 @@ describe Ahoy::Chart do
|
||||
create(:vote, votable: create(:budget_investment), created_at: time_2)
|
||||
create(:vote, votable: create(:proposal), created_at: time_2)
|
||||
|
||||
chart = Ahoy::Chart.new(:user_supported_budgets)
|
||||
chart = Ahoy::Chart.new(:budget_investment_supported)
|
||||
|
||||
expect(chart.data_points).to eq x: ["2017-04-01", "2017-04-02"], "User Supported Budgets" => [1, 2]
|
||||
expect(chart.data_points).to eq x: ["2017-04-01", "2017-04-02"],
|
||||
"Budget investments supported" => [1, 2]
|
||||
end
|
||||
|
||||
it "returns level three verified dates for the level_3_user event" do
|
||||
@@ -70,7 +72,7 @@ describe Ahoy::Chart do
|
||||
|
||||
chart = Ahoy::Chart.new(:level_3_user)
|
||||
|
||||
expect(chart.data_points).to eq x: ["2001-01-02"], "Level 3 users" => [2]
|
||||
expect(chart.data_points).to eq x: ["2001-01-02"], "Level 3 users verified" => [2]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -145,10 +145,10 @@ describe "Stats", :admin do
|
||||
visit admin_stats_path
|
||||
|
||||
within("#stats") do
|
||||
click_link "Debates"
|
||||
click_link "Debates created"
|
||||
end
|
||||
|
||||
expect(page).to have_content "Debates (1)"
|
||||
expect(page).to have_content "Debates created (1)"
|
||||
|
||||
within("#graph") do
|
||||
expect(page).to have_content Date.current.strftime("%Y-%m-%d")
|
||||
@@ -159,9 +159,9 @@ describe "Stats", :admin do
|
||||
create(:user, :level_three)
|
||||
|
||||
visit admin_stats_path
|
||||
click_link "Level 3 users"
|
||||
click_link "Level 3 users verified"
|
||||
|
||||
expect(page).to have_content "Level 3 users (1)"
|
||||
expect(page).to have_content "Level 3 users verified (1)"
|
||||
|
||||
within("#graph") do
|
||||
expect(page).to have_content Date.current.strftime("%Y-%m-%d")
|
||||
|
||||
Reference in New Issue
Block a user