From 040e4b27409d678253b3803e6be9d3b3f3652447 Mon Sep 17 00:00:00 2001 From: Wen Date: Wed, 30 Apr 2014 09:13:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=89=93=E5=88=86.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/user_score_helper.rb | 20 ++++++++++---------- app/views/test/index.html.erb | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/helpers/user_score_helper.rb b/app/helpers/user_score_helper.rb index 5b455a01..42b81fbd 100644 --- a/app/helpers/user_score_helper.rb +++ b/app/helpers/user_score_helper.rb @@ -62,8 +62,8 @@ module UserScoreHelper issues.each do |i| ptcs = PraiseTreadCache.where('object_id = ?', i.id) ptcs.each do |p| - praise_count = praise_count + p.praise_num - tread_count = tread_count + p.tread_num + praise_count = praise_count + p.praise_num.to_i + tread_count = tread_count + p.tread_num.to_i end end @@ -71,8 +71,8 @@ module UserScoreHelper bids.each do |b| ptcs = PraiseTreadCache.where('object_id = ?', b.id) ptcs.each do |p| - praise_count = praise_count + p.praise_num - tread_count = tread_count + p.tread_num + praise_count = praise_count + p.praise_num.to_i + tread_count = tread_count + p.tread_num.to_i end end @@ -80,8 +80,8 @@ module UserScoreHelper contests.each do |c| ptcs = PraiseTreadCache.where('object_id = ?', c.id) ptcs.each do |p| - praise_count = praise_count + p.praise_num - tread_count = tread_count + p.tread_num + praise_count = praise_count + p.praise_num.to_i + tread_count = tread_count + p.tread_num.to_i end end @@ -91,7 +91,7 @@ module UserScoreHelper skill_score = 0 if level == 0 - skill_score = praise_count - 0.5 * tread_count + skill_score = praise_count - 2.5 * tread_count end if level == 1 skill_score = 2 * praise_count - 1.5 * tread_count @@ -135,7 +135,7 @@ module UserScoreHelper issues.each do |i| ptcs = PraiseTreadCache.where('object_id = ?', i.id) ptcs.each do |p| - if p.praise_num > max_praise_num + if p.praise_num.to_i > max_praise_num.to_i max_praise_num = p.praise_num end end @@ -145,7 +145,7 @@ module UserScoreHelper bids.each do |b| ptcs = PraiseTreadCache.where('object_id = ?', b.id) ptcs.each do |p| - if p.praise_num > max_praise_num + if p.praise_num.to_i > max_praise_num.to_i max_praise_num = p.praise_num end end @@ -155,7 +155,7 @@ module UserScoreHelper contests.each do |c| ptcs = PraiseTreadCache.where('object_id = ?', c.id) ptcs.each do |p| - if p.praise_num > max_praise_num + if p.praise_num.to_i > max_praise_num.to_i max_praise_num = p.praise_num end end diff --git a/app/views/test/index.html.erb b/app/views/test/index.html.erb index 0aa1a5d9..589412dd 100644 --- a/app/views/test/index.html.erb +++ b/app/views/test/index.html.erb @@ -17,8 +17,8 @@ <%= calculate_skill_count(user) %> <%= calculate_file(user) %> <%= calculate_issue(user) %> - <%= calculate_level(user) %> ---> + <%= calculate_level(user) %>--> + <%= user.changesets.count %> <% end %>