用户打分.

This commit is contained in:
Wen 2014-04-30 09:13:05 +08:00
parent 0cfd5929d8
commit 040e4b2740
2 changed files with 12 additions and 12 deletions

View File

@ -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

View File

@ -17,8 +17,8 @@
<td><%= calculate_skill_count(user) %></td>
<td><%= calculate_file(user) %></td>
<td><%= calculate_issue(user) %></td>
<td><%= calculate_level(user) %></td>
-->
<td><%= calculate_level(user) %></td>-->
<td><%= user.changesets.count %></td>
</tr>
<% end %>