refactors querying for assignable users

It is still not as fast as it should be. Even after refactoring it takes 1-2 seconds before the answer is calculated (used to be 5-6).
Merge pull request #27 from opf/perf/assignable_users_in_db

refactors querying for assignable users