lib/eco/api/microcases/people_search.rb in eco-helpers-2.0.16 vs lib/eco/api/microcases/people_search.rb in eco-helpers-2.0.17
- old
+ new
@@ -12,14 +12,14 @@
def people_search(data, options: {}, silent: true)
session.logger.info("Going to api get #{data.length} entries...")
start = Time.now
people = session.batch.search(data, silent: silent).yield_self do |status|
- secs = Time.now - start
+ secs = (Time.now - start).round(3)
Eco::API::Organization::People.new(status.people).tap do |people|
cnt = people.count
- per_sec = (cnt.to_f / secs).floor
+ per_sec = (cnt.to_f / secs).round(2)
msg = "... could get #{cnt} people (out of #{data.length} entries) in #{secs} seconds (#{per_sec} people/sec)"
session.logger.info(msg)
end
end
@@ -27,14 +27,14 @@
supers = people_search_prepare_supers_request(people)
if supers.length > 0
session.logger.info(" Going to api get #{supers.length} current supervisors...")
start = Time.now
people = session.batch.search(supers, silent: silent).yield_self do |status|
- secs = Time.now - start
+ secs = (Time.now - start).round(3)
found = status.people
cnt = found.count
- per_sec = (cnt.to_f / secs).floor
+ per_sec = (cnt.to_f / secs).round(2)
msg = "... could find #{cnt} current supers (out of #{supers.length}) in #{secs} seconds (#{per_sec} people/sec)"
session.logger.info(msg)
people.merge(found, strict: micro.strict_search?(options))
end
end
@@ -44,13 +44,13 @@
if supers.length > 0
session.logger.info(" Going to api get #{supers.length} supervisors as per input entries...")
start = Time.now
people = session.batch.search(supers, silent: silent).yield_self do |status|
- secs = Time.now - start
+ secs = (Time.now - start).round(3)
found = status.people
cnt = found.count
- per_sec = (cnt.to_f / secs).floor
+ per_sec = (cnt.to_f / secs).round(2)
msg = "... could find #{cnt} input supers (out of #{supers.length}) in #{secs} seconds (#{per_sec} people/sec)"
session.logger.info(msg)
people.merge(found, strict: micro.strict_search?(options))
end
end