From 3d5390dfb0be707c50590504dec595c5635ea35f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Salvador=20P=C3=A9rez=20Garc=C3=ADa?= Date: Fri, 27 Jul 2018 20:11:19 +0200 Subject: [PATCH] Fixes #245 Poll card now shows the responses to the poll in the public side --- app/models/poll.rb | 3 +++ app/views/dashboard/polls/_poll.html.erb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/poll.rb b/app/models/poll.rb index f01960bd6..be313d75b 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -113,4 +113,7 @@ class Poll < ActiveRecord::Base related.nil? end + def answer_count + Poll::Answer.where(question: questions).count + end end diff --git a/app/views/dashboard/polls/_poll.html.erb b/app/views/dashboard/polls/_poll.html.erb index 5fc2fa4b7..1519eff18 100644 --- a/app/views/dashboard/polls/_poll.html.erb +++ b/app/views/dashboard/polls/_poll.html.erb @@ -13,7 +13,7 @@
- <%= t("dashboard.polls.poll.responses", count: poll.questions.count) %> + <%= t("dashboard.polls.poll.responses", count: poll.answer_count) %>