Related Users

From SharedTree Wiki

Jump to: navigation, search


The upcoming related Users page will show you a list of users who are related to you within 10 generations. This is for the purpose of coordinating research efforts, not to be able to see their information.

Issues:

You may be related to someone in multiple ways. We need to sort the ways and pick the "closest" way that incurs the fewest number of steps. I may be able to use the distance factor to do this. I also need to figure out how to eliminate lots of side steps. I should probably only go up the tree, not sideways.

select min_dist, user_id, given_name, family_name from (
select p2.user_id, MIN(p1.distance + p2.distance) min_dist
from app_user_line_person p1
join app_user_line_person p2 ON p1.person_id = p2.person_id
join tree_person p ON p1.person_id = p.person_id and p.actual_end_date > NOW()
where p1.user_id = 1 and p2.user_id <> p1.user_id
group by p2.user_id) t
join app_user using (user_id)
order by min_dist
Personal tools