I am currently working on a sports app. Users should be able to create new teams and add users to the teams. When a user creates the team, he/she should be able to search for users to add to the team, however the search should only return users that are not yet part of the team. I created a task for it, here is the method
def search_users_for_team(team_id, search_item)
available_users = Array.new
temp_users = store._users.where(name: { '$regex' => /.*#{search_item}.*/, '$options' => 'i' }).all
team_users = store._teams.where(id: team_id).first._members
team_users_ids = []
team_users.each{ |user|
team_users_ids << user.id
}
temp_users.each{ |user|
if !team_users_ids.include?(user.id)
available_users << user
end
}
available_users
end
However i always get a string back from the function.
Did i miss something about tasks in volt.
I use volt 0.9.4.
Regards, Kevin