<p>In app/models/user.rb:</p>
<pre style='color:#555'>> + # 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}
</pre>
<p>Unfortunately the <code>nearby</code> 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.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">
—<br>
Reply to this email directly or <a href='https://github.com/openstreetmap/openstreetmap-website/pull/54/files#r1358593'>view it on GitHub</a>.
</p>
<img src='https://github.com/notifications/beacon/uTRSc6ihLa7Shf84BpiOpmLWAu4oQih75mggZl1E8_ncpsL_vuCSTJlxIVuE64FQ.gif' height='1' width='1'>