Common contacts
Reported by Michael Hartl | April 16th, 2008 @ 10:48 AM | in 25 April 2008 Friday release
Profile pages should show the contacts that two people have in common. Should be an easy database intersection (famous last words…).
Comments and changes to this ticket
-
Jorge Dias April 19th, 2008 @ 10:17 AM
- → State changed from new to open
- → Assigned user changed from to Jorge Dias
-
Jorge Dias April 21st, 2008 @ 03:10 AM
I forgot to submit a file...will fix this when i get home
Fixed this in my fork. Also added a little behaviour to exclude the user with id 1, from the common friends. I did this because since everybody is a friend of admin by default, it wouldn't be relevant to list him as a common friend.
-
Michael Hartl April 22nd, 2008 @ 09:39 PM
- → State changed from open to resolved
Good work. I decided to show the common admin user (ID = 1). Also, try to stay within an 80-character width. See the refactored version of common_connections_with for an example of what I'm looking for:
def common_connections_with(person, page = 1) sql = %(SELECT connections.*, COUNT(contact_id) FROM `connections` WHERE ((person_id = ? OR person_id = ?) AND status=?) GROUP BY contact_id HAVING count(contact_id) = 2) conditions = [sql, id, person.id, Connection::ACCEPTED] opts = { :page => page, :per_page => RASTER_PER_PAGE } @common_connections ||= Connection.paginate_by_sql(conditions, opts) end -
Michael Hartl April 22nd, 2008 @ 09:41 PM
- → Milestone changed from to 25 April 2008 Friday release
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
