From c6576c71bf4f92341740b2229139c3845e8901a3 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Mon, 5 May 2014 10:01:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E6=AF=8F=E4=B8=AAap?= =?UTF-8?q?p=E6=89=93=E5=88=86=E7=9A=84=E6=80=BB=E4=BA=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/softapplications_controller.rb | 4 +++- app/views/softapplications/show.html.erb | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index 281f6216d..3aba819e0 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -56,8 +56,10 @@ class SoftapplicationsController < ApplicationController @stars_status_map = Hash.new(0.0) stars_status.each do |star_status| + percent = percent_of(star_status.scount, stars_reates_count).to_f + percent_m = format("%.2f", percent) @stars_status_map["star#{star_status.stars.to_i}".to_sym] = - percent_of(star_status.scount, stars_reates_count).to_s + "%" + percent_m.to_s + "%" end @jours = @softapplication.journals_for_messages.order('created_on DESC') @image_results = [] diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index e68ae699f..c2f260e60 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -63,8 +63,9 @@
应用得分:
+
-
+
得分比例
<% 100.step(20,-20) do |star| %> @@ -83,6 +84,10 @@
最终得分
<%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %>
+
+
打分总人数
+
<%= @softapplication.raters(:quality).count%>
+