[openstreetmap-website] User page redesign a.k.a. activity stream (#54)

Tom Hughes notifications at github.com
Sun Aug 12 16:42:23 BST 2012


> +  # Returns a hash of statistics.
> +  # Currently this is limited, will extend for usage history.
> +  def statistics
> +    {
> +      :changesets => self.changesets.count,
> +      :friends => self.friends.count
> +    }
> +  end
> +
> +  def recent_changesets(limit = 5)
> +    self.changesets.includes(:changeset_tags).limit(limit)
> +  end
> +
> +  def recent_activities(limit = 10)
> +    nearby_changesets = []
> +    self.nearby.each {|user| nearby_changesets += user.recent_changesets.to_a}

Unfortunately the `nearby` method on a user is very expensive, so we need to be very careful where we're using it, or find a way to optimise it.

---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/54/files#r1358593
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20120812/ba81b55d/attachment.html>


More information about the rails-dev mailing list