From 3acec4b7c10c082c25b1f4e79cadc8b5e1adc013 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 17 Jan 2015 10:14:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E6=80=BB?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/poll_helper.rb | 8 +++++--- app/views/poll/_choice_show.html.erb | 2 +- app/views/poll/statistics_result.html.erb | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/helpers/poll_helper.rb b/app/helpers/poll_helper.rb index 55418faf2..36b5deccb 100644 --- a/app/helpers/poll_helper.rb +++ b/app/helpers/poll_helper.rb @@ -48,15 +48,16 @@ module PollHelper end end - #统计答题百分比 + #统计答题百分比,统计结果保留两位小数 def statistics_result_percentage(e, t) e = e.to_f t = t.to_f t == 0 ? 0 : format("%.2f", e*100/t) end - def options_show p - case p + #页面体型显示 + def options_show pq + case pq when 1 "单选题" when 2 @@ -65,4 +66,5 @@ module PollHelper "问答题" end end + end \ No newline at end of file diff --git a/app/views/poll/_choice_show.html.erb b/app/views/poll/_choice_show.html.erb index 16971d5ad..4ccc5b938 100644 --- a/app/views/poll/_choice_show.html.erb +++ b/app/views/poll/_choice_show.html.erb @@ -19,7 +19,7 @@ <% end %> <%= l(:label_poll_valid_commit) %> - <%= poll_question.poll_votes.count %> + <%= @poll.users.count %>   diff --git a/app/views/poll/statistics_result.html.erb b/app/views/poll/statistics_result.html.erb index 057314a9c..3ef29eb48 100644 --- a/app/views/poll/statistics_result.html.erb +++ b/app/views/poll/statistics_result.html.erb @@ -27,7 +27,7 @@
- + From 9487ce1245894efa0a9a45314c4ec6de7f93ebd1 Mon Sep 17 00:00:00 2001 From: z9hang Date: Sat, 17 Jan 2015 11:02:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?#1807=E8=AF=BE=E7=A8=8B--=E9=97=AE=E5=8D=B7?= =?UTF-8?q?=E8=B0=83=E6=9F=A5=EF=BC=9A=E7=AD=94=E9=A2=98=E5=A4=9A=E8=A1=8C?= =?UTF-8?q?=E4=B8=BB=E8=A7=82=E5=90=8E=EF=BC=8C=E5=86=8D=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=89=93=E5=BC=80=E7=AD=94=E9=A2=98=E9=A1=B5=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E5=A6=82=E5=9B=BE=EF=BC=8C=E6=98=BE=E7=A4=BAhtml=E5=85=83?= =?UTF-8?q?=E7=B4=A0
?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/poll/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/poll/show.html.erb b/app/views/poll/show.html.erb index c1ac5d377..bc5136718 100644 --- a/app/views/poll/show.html.erb +++ b/app/views/poll/show.html.erb @@ -180,7 +180,7 @@ } - > + > <% elsif pq.question_type == 4 %> @@ -222,7 +222,7 @@ }); } -
" onblur="onblur_<%= pq.id %>(this);"><%= get_anwser_vote_text(pq.id,User.current.id) %>
+
" onblur="onblur_<%= pq.id %>(this);"><%= get_anwser_vote_text(pq.id,User.current.id).html_safe %>