Skip to content

Instantly share code, notes, and snippets.

@Prav92
Created July 19, 2017 16:17
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 Prav92/c97665548bfea89c2a45186e7f5a6d0f to your computer and use it in GitHub Desktop.
Save Prav92/c97665548bfea89c2a45186e7f5a6d0f to your computer and use it in GitHub Desktop.
def self.search_007(query, lat, lon, offset, limit, options={})
if options.values.compact.any?
return search_007b(query, lat, lon, offset, limit, options)
end
if lat.nil? || lon.nil?
return search_007x(query, offset, limit)
end
Doctor.where("doctors.full_name LIKE ?", "%#{query}%")
.order("doctors.overall_rating DESC")
.calculate_distance2a(lat, lon)
.where("healthcare_centers.type_id != 4")
.having("distance <= 25")
.order("doctors.full_name")
.offset(offset)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment