From 0f73b787b2fda47f95130df2395511ade1fbaca8 Mon Sep 17 00:00:00 2001 From: iagirre Date: Tue, 17 Oct 2017 16:07:44 +0200 Subject: [PATCH] Fixed views and Poll::Stats model to pass the specs --- app/models/poll/stats.rb | 2 +- app/views/polls/_results_subnavigation.html.erb | 4 ++-- app/views/polls/show.html.erb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/poll/stats.rb b/app/models/poll/stats.rb index 1eef537a0..1df281434 100644 --- a/app/models/poll/stats.rb +++ b/app/models/poll/stats.rb @@ -26,7 +26,7 @@ class Poll end def total_participants_web_percentage - total_participants_web * 100 / total_participants + (total_participants) == 0 ? 0 : total_participants_web * 100 / total_participants end def total_participants_booth diff --git a/app/views/polls/_results_subnavigation.html.erb b/app/views/polls/_results_subnavigation.html.erb index afff4de03..43aa95b40 100644 --- a/app/views/polls/_results_subnavigation.html.erb +++ b/app/views/polls/_results_subnavigation.html.erb @@ -1,14 +1,14 @@
    -
  • +
  • <%= link_to "#tab-stats" do %>

    <%= "Estadísticas" %>

    <% end %>
  • -
  • +
  • <%= link_to "#tab-information" do %>

    <%= "Información" %> diff --git a/app/views/polls/show.html.erb b/app/views/polls/show.html.erb index e7e22124e..e4e11af6f 100644 --- a/app/views/polls/show.html.erb +++ b/app/views/polls/show.html.erb @@ -32,10 +32,10 @@
    <%= render "results_subnavigation" %> -
    +
    <%= render "polls/stats/show" %>
    -
    +
    <%= render "show" %>