JnBrymn / minglbot

0 stars 0 forks source link

Make the hydration preserve the ordering and grouping #5

Open JnBrymn opened 10 years ago

JnBrymn commented 10 years ago

Consider:

friends = m.get_friends(some_group_of_users)
friends = m.hydrate_users(friends)
friends = m.get_friends(some_group_of_users)
for k,v in friends.iteritems():
    print k
    for u in v:
        #print "\t", u.screen_name, u.id#,"\n\t\t",u["name"],"\n\t\t",u["description"],"\n\n"
        print "\t", u.screen_name

After you get friends some of them might not have their details, so you have to hydrate. But hydration loses the order and grouping of the friends, so before you can print the friends you have to retrieve them again. This time they're already in neo4j, so you don't have to go to twitter any more, but this is unnecessary. Ih hydration preserved order we wouldn't have this problem.