Sha256: ef6b5e2fab7343ada057b594f7de70752d61aa27bc81d728258bbd42f43f5aa8

Contents?: true

Size: 1.17 KB

Versions: 17

Compression:

Stored size: 1.17 KB

Contents

require 'xampl_generated_code/RandomPeople'
require 'people'
require 'settings'

module RandomPeople

  #<people pid=''
  #        xmlns="http://xampl.com/people">
  #    <person pid=''
  #            given-name=''
  #            surname=''
  #            email=''
  #            phone=''>
  #        <address pid=''
  #                 street-address=''
  #                 city=''
  #                 state=''
  #                 postal-code=''/>
  #    </person>
  #</people>

  10.times do

    people = Xampl.transaction("random-people") do
      Person.find_by_query do | q |
        q.add_condition('city', :equals, 'TORONTO')
        q.add_condition('email', :ends_with, 'dodgit.com')

        q.order_by('surname', :strasc)
      end
    end

    first_person = people.first
    address = first_person.address.first

    start_at = Time.now

    people_at_address = Xampl.transaction("random-people") do
      Xampl.find_mentions_of(address)
    end

    done = Time.now
    puts "found #{ people_at_address.size } people at that address in: #{ done - start_at }, #{ people_at_address.size / (done - start_at) }/s"
#    people_at_address.each { | person | puts person.pp_xml }
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
hutch-xamplr-1.1.0 examples/random-people-shared-addresses/find-mentions.rb
hutch-xamplr-1.1.1 examples/random-people-shared-addresses/find-mentions.rb
hutch-xamplr-1.1.2 examples/random-people-shared-addresses/find-mentions.rb
hutch-xamplr-1.1.4 examples/random-people-shared-addresses/find-mentions.rb
hutch-xamplr-1.2.0 examples/random-people-shared-addresses/find-mentions.rb
hutch-xamplr-1.3.0 examples/random-people-shared-addresses/find-mentions.rb
hutch-xamplr-1.3.1 examples/random-people-shared-addresses/find-mentions.rb
hutch-xamplr-1.3.10 examples/random-people-shared-addresses/find-mentions.rb
hutch-xamplr-1.3.11 examples/random-people-shared-addresses/find-mentions.rb
hutch-xamplr-1.3.12 examples/random-people-shared-addresses/find-mentions.rb
hutch-xamplr-1.3.13 examples/random-people-shared-addresses/find-mentions.rb
hutch-xamplr-1.3.14 examples/random-people-shared-addresses/find-mentions.rb
hutch-xamplr-1.3.3 examples/random-people-shared-addresses/find-mentions.rb
hutch-xamplr-1.3.8 examples/random-people-shared-addresses/find-mentions.rb
hutch-xamplr-1.3.9 examples/random-people-shared-addresses/find-mentions.rb
xamplr-1.3.15 examples/random-people-shared-addresses/find-mentions.rb
xamplr-1.2.0 examples/random-people-shared-addresses/find-mentions.rb