Skip to content

Instantly share code, notes, and snippets.

@jturolla
Created September 8, 2016 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jturolla/d3f4d1e59fea36897ff00532f94edfb5 to your computer and use it in GitHub Desktop.
Save jturolla/d3f4d1e59fea36897ff00532f94edfb5 to your computer and use it in GitHub Desktop.
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