[openstreetmap/openstreetmap-website] Add counts for notes and diary comments to user profiles (#1774)

Aaron Lidman notifications at github.com
Thu Mar 1 21:15:33 UTC 2018


aaronlidman commented on this pull request.



> @@ -25,7 +25,7 @@
 
 class NoteComment < ActiveRecord::Base
   belongs_to :note, :foreign_key => :note_id, :touch => true
-  belongs_to :author, :class_name => "User", :foreign_key => :author_id
+  belongs_to :author, :class_name => "User", :foreign_key => :author_id, :counter_cache => :notes_count

I think `note_comments_count` is less accurate because we're not counting the number of comments but rather the number of authored notes. So `note_comments_count` isn't exactly right because a user can comment multiple times on a note but maybe `note_authored_count` is a better name?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/1774#discussion_r171695782
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20180301/e10f6de7/attachment.html>


More information about the rails-dev mailing list