Permalink
Browse files

quickly fix user rank

  • Loading branch information...
1 parent ba30841 commit 709b0a56a36e69c5a93c564b2f75f3d793c796a6 @flyerhzm flyerhzm committed Jul 27, 2010
@@ -19,6 +19,6 @@ def resource
end
def collection
- @users = User.order("posts_count * 5 + 2 * votes_count + comments_count desc")
+ @users = User.order("(posts_count * 5 + 2 * votes_count + comments_count) desc").limit(50)
end
end
@@ -249,5 +249,5 @@ body {
}
.posts-section .new .new-icon {
top: -20px;
- left: 100px;
+ left: 110px;
}
@@ -20,3 +20,8 @@ table.users {
}
}
}
+.rank-hint {
+ margin-top: 20px;
+ line-height: 30px;
+}
+
@@ -18,8 +18,7 @@
%td.comments= user.comments_count
%td.score= user.posts_count * 10 + user.comments_count * 2 + user.votes_count
-- if @users.size > 100
+.rank-hint
%p lower scoring users not shown
%p score = posts * 10 + comments * 2 + votes.
-
@@ -6,7 +6,7 @@ def self.up
add_column :users, :votes_count, :integer, :default => 0, :null => false
User.all.each do |user|
- user.update_attributes(:posts_count => user.posts.length, :implementations_count => user.implementations.length, :comments_count => user.comments.length, :votes_count => user.votes.length)
+ User.update_counters user.id, :posts_count => user.posts.length, :implementations_count => user.implementations.length, :comments_count => user.comments.length, :votes_count => user.votes.length
end
end

0 comments on commit 709b0a5

Please sign in to comment.