diff --git a/app/views/admin/stats/_graph.html.erb b/app/views/admin/stats/_graph.html.erb index 44124b12d..1a8975289 100644 --- a/app/views/admin/stats/_graph.html.erb +++ b/app/views/admin/stats/_graph.html.erb @@ -1,6 +1,6 @@ <%= back_link_to %>
-

<%= t "admin.stats.graph.#{name || event}" %>(<%= count %>)

+

<%= t "admin.stats.graph.#{name || event}" %> (<%= count %>)

<%= chart_tag id: name, event: event %>
diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 7baa7a31c..96c302be6 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -1451,7 +1451,6 @@ en: verified_users_who_didnt_vote_proposals: Verified users who didn't votes proposals visits: Visits votes: Total votes - spending_proposals_title: Spending Proposals budgets_title: Participatory budgeting direct_messages: Direct messages proposal_notifications: Proposal notifications diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 6124e2e6d..16ed55b4c 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -1450,7 +1450,6 @@ es: verified_users_who_didnt_vote_proposals: Usuarios verificados que no han votado propuestas visits: Visitas votes: Votos - spending_proposals_title: Propuestas de inversión budgets_title: Presupuestos participativos direct_messages: Mensajes directos proposal_notifications: Notificaciones de propuestas diff --git a/spec/controllers/admin/api/stats_controller_spec.rb b/spec/controllers/admin/api/stats_controller_spec.rb index d9a2cdeb4..291c100d8 100644 --- a/spec/controllers/admin/api/stats_controller_spec.rb +++ b/spec/controllers/admin/api/stats_controller_spec.rb @@ -31,23 +31,13 @@ describe Admin::Api::StatsController do it "returns single events formated for working with c3.js" do sign_in user - get :show, params: { events: "foo" } + get :show, params: { event: "foo" } expect(response).to be_ok data = JSON.parse(response.body) expect(data).to eq "x" => ["2015-01-01", "2015-01-02"], "Foo" => [2, 1] end - - it "returns combined comma separated events formated for working with c3.js" do - sign_in user - get :show, params: { events: "foo,bar" } - - expect(response).to be_ok - - data = JSON.parse(response.body) - expect(data).to eq "x" => ["2015-01-01", "2015-01-02", "2015-01-03"], "Foo" => [2, 1, 0], "Bar" => [1, 0, 2] - end end context "visits present" do @@ -69,29 +59,6 @@ describe Admin::Api::StatsController do end end - context "visits and events present" do - it "returns combined events and visits formated for working with c3.js" do - time_1 = Time.zone.local(2015, 01, 01) - time_2 = Time.zone.local(2015, 01, 02) - - create :ahoy_event, name: "foo", time: time_1 - create :ahoy_event, name: "foo", time: time_2 - create :ahoy_event, name: "foo", time: time_2 - - create :visit, started_at: time_1 - create :visit, started_at: time_1 - create :visit, started_at: time_2 - - sign_in user - get :show, params: { events: "foo", visits: true } - - expect(response).to be_ok - - data = JSON.parse(response.body) - expect(data).to eq "x" => ["2015-01-01", "2015-01-02"], "Foo" => [1, 2], "Visits" => [2, 1] - end - end - context "budget investments present" do it "returns budget investments formated for working with c3.js" do time_1 = Time.zone.local(2017, 04, 01) diff --git a/spec/features/admin/stats_spec.rb b/spec/features/admin/stats_spec.rb index 7422f0e2a..64af655cf 100644 --- a/spec/features/admin/stats_spec.rb +++ b/spec/features/admin/stats_spec.rb @@ -97,7 +97,7 @@ feature "Stats" do visit admin_stats_path - expect(page).to have_content "Level 2 User (1)" + expect(page).to have_content "Level two users 1" end end diff --git a/spec/features/campaigns_spec.rb b/spec/features/campaigns_spec.rb index 681cd33c1..517c95481 100644 --- a/spec/features/campaigns_spec.rb +++ b/spec/features/campaigns_spec.rb @@ -15,8 +15,13 @@ feature "Email campaigns" do 5.times { visit root_url(track_id: @campaign2.track_id) } visit admin_stats_path + click_link @campaign1.name expect(page).to have_content "#{@campaign1.name} (3)" + + click_link "Go back" + click_link @campaign2.name + expect(page).to have_content "#{@campaign2.name} (5)" end @@ -25,9 +30,13 @@ feature "Email campaigns" do visit root_url(track_id: "999") visit admin_stats_path + click_link @campaign1.name expect(page).to have_content "#{@campaign1.name} (1)" + + click_link "Go back" + expect(page).not_to have_content @campaign2.name.to_s end -end \ No newline at end of file +end