Created
September 8, 2016 11:51
-
-
Save jturolla/d3f4d1e59fea36897ff00532f94edfb5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_taskers | |
Tasker.near(job.to_coordinates, 20, units: :km) | |
.where(query_params) | |
.where(service_ids: { '$all' => required_services }) | |
.limit(config.list_limit) | |
end | |
def query_params | |
{ | |
:id.nin => invalid_taskers, | |
:active => true, | |
:availability.in => [job_week_day], | |
:completed_jobs.gte => min_jobs_quantity, | |
:state => "verified", | |
} | |
end | |
def invalid_taskers | |
[].tap do |ids| | |
ids << already_received_offer | |
ids << jobs_invalid | |
ids << user_bad_feedbacks | |
ids << blocked_taskers | |
end.flatten.compact | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment