diff --git a/app/components/admin/stats/budget_supporting_component.rb b/app/components/admin/stats/budget_supporting_component.rb index 9626b033f..5d7b9cea2 100644 --- a/app/components/admin/stats/budget_supporting_component.rb +++ b/app/components/admin/stats/budget_supporting_component.rb @@ -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 diff --git a/app/models/ahoy/chart.rb b/app/models/ahoy/chart.rb index 7f445b469..033a55c56 100644 --- a/app/models/ahoy/chart.rb +++ b/app/models/ahoy/chart.rb @@ -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 diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 333bd6bcd..66ff65ea1 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -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" diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index bac399ade..81297a548 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -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" diff --git a/spec/components/admin/stats/event_links_component_spec.rb b/spec/components/admin/stats/event_links_component_spec.rb index 08eb07c01..847c2047a 100644 --- a/spec/components/admin/stats/event_links_component_spec.rb +++ b/spec/components/admin/stats/event_links_component_spec.rb @@ -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 diff --git a/spec/controllers/admin/api/stats_controller_spec.rb b/spec/controllers/admin/api/stats_controller_spec.rb index ee6d0a014..472fbda86 100644 --- a/spec/controllers/admin/api/stats_controller_spec.rb +++ b/spec/controllers/admin/api/stats_controller_spec.rb @@ -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 diff --git a/spec/models/ahoy/chart_spec.rb b/spec/models/ahoy/chart_spec.rb index fe42972a8..3791aff51 100644 --- a/spec/models/ahoy/chart_spec.rb +++ b/spec/models/ahoy/chart_spec.rb @@ -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 diff --git a/spec/system/admin/stats_spec.rb b/spec/system/admin/stats_spec.rb index f64a8eb23..88c77cf2d 100644 --- a/spec/system/admin/stats_spec.rb +++ b/spec/system/admin/stats_spec.rb @@ -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")