用户打分.
This commit is contained in:
parent
0cfd5929d8
commit
040e4b2740
|
@ -62,8 +62,8 @@ module UserScoreHelper
|
||||||
issues.each do |i|
|
issues.each do |i|
|
||||||
ptcs = PraiseTreadCache.where('object_id = ?', i.id)
|
ptcs = PraiseTreadCache.where('object_id = ?', i.id)
|
||||||
ptcs.each do |p|
|
ptcs.each do |p|
|
||||||
praise_count = praise_count + p.praise_num
|
praise_count = praise_count + p.praise_num.to_i
|
||||||
tread_count = tread_count + p.tread_num
|
tread_count = tread_count + p.tread_num.to_i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -71,8 +71,8 @@ module UserScoreHelper
|
||||||
bids.each do |b|
|
bids.each do |b|
|
||||||
ptcs = PraiseTreadCache.where('object_id = ?', b.id)
|
ptcs = PraiseTreadCache.where('object_id = ?', b.id)
|
||||||
ptcs.each do |p|
|
ptcs.each do |p|
|
||||||
praise_count = praise_count + p.praise_num
|
praise_count = praise_count + p.praise_num.to_i
|
||||||
tread_count = tread_count + p.tread_num
|
tread_count = tread_count + p.tread_num.to_i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -80,8 +80,8 @@ module UserScoreHelper
|
||||||
contests.each do |c|
|
contests.each do |c|
|
||||||
ptcs = PraiseTreadCache.where('object_id = ?', c.id)
|
ptcs = PraiseTreadCache.where('object_id = ?', c.id)
|
||||||
ptcs.each do |p|
|
ptcs.each do |p|
|
||||||
praise_count = praise_count + p.praise_num
|
praise_count = praise_count + p.praise_num.to_i
|
||||||
tread_count = tread_count + p.tread_num
|
tread_count = tread_count + p.tread_num.to_i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ module UserScoreHelper
|
||||||
skill_score = 0
|
skill_score = 0
|
||||||
|
|
||||||
if level == 0
|
if level == 0
|
||||||
skill_score = praise_count - 0.5 * tread_count
|
skill_score = praise_count - 2.5 * tread_count
|
||||||
end
|
end
|
||||||
if level == 1
|
if level == 1
|
||||||
skill_score = 2 * praise_count - 1.5 * tread_count
|
skill_score = 2 * praise_count - 1.5 * tread_count
|
||||||
|
@ -135,7 +135,7 @@ module UserScoreHelper
|
||||||
issues.each do |i|
|
issues.each do |i|
|
||||||
ptcs = PraiseTreadCache.where('object_id = ?', i.id)
|
ptcs = PraiseTreadCache.where('object_id = ?', i.id)
|
||||||
ptcs.each do |p|
|
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
|
max_praise_num = p.praise_num
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -145,7 +145,7 @@ module UserScoreHelper
|
||||||
bids.each do |b|
|
bids.each do |b|
|
||||||
ptcs = PraiseTreadCache.where('object_id = ?', b.id)
|
ptcs = PraiseTreadCache.where('object_id = ?', b.id)
|
||||||
ptcs.each do |p|
|
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
|
max_praise_num = p.praise_num
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -155,7 +155,7 @@ module UserScoreHelper
|
||||||
contests.each do |c|
|
contests.each do |c|
|
||||||
ptcs = PraiseTreadCache.where('object_id = ?', c.id)
|
ptcs = PraiseTreadCache.where('object_id = ?', c.id)
|
||||||
ptcs.each do |p|
|
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
|
max_praise_num = p.praise_num
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
<td><%= calculate_skill_count(user) %></td>
|
<td><%= calculate_skill_count(user) %></td>
|
||||||
<td><%= calculate_file(user) %></td>
|
<td><%= calculate_file(user) %></td>
|
||||||
<td><%= calculate_issue(user) %></td>
|
<td><%= calculate_issue(user) %></td>
|
||||||
<td><%= calculate_level(user) %></td>
|
<td><%= calculate_level(user) %></td>-->
|
||||||
-->
|
|
||||||
<td><%= user.changesets.count %></td>
|
<td><%= user.changesets.count %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue