Closed LarryBattle closed 11 years ago
Also, your translation is a bit off. Correct me if I'm wrong.
For this example
task getUserFriends(userName)
wait for user from db.users.findOne {name:userName}
wait for friends from db.friends.find {userId:user.id}
if user.type is 'power user'
for parallel friend in friends
wait for friendsOfFriend from db.friends.find friend
for newFriend in friendsOfFriend
friends.push newFriend unless newFriend in friends
return friends
Shouldn't
wait for friendsOfFriend from db.friends.find friend
be
wait for friendsOfFriend from db.friends.find {userId:friend}
Also, in the example
var getUserFriends = function (userName, next) {
db.users.findOne({name:userName}, function (err, user) {
if (err != null) return next(err);
getFriendsById(userId, function (err, friends) {
if (err != null) return next(err);
Shouldn't
getFriendsById(userId, function (err, friends) {
be
getFriendsById(user.id, function (err, friends) {
Thanks so much for catching these bugs. I'll go through and make the fixes soon.
Oops I changed the wrong line. 11e46e3385abd783b3a6d90d8e4c727c917696d1 should fix it.
Your javascript on the homepage is slightly incorrect.
Old Code:
New Code:
Could you update it?