Skip to content

Instantly share code, notes, and snippets.

@kenton
Created November 30, 2012 14:11
Show Gist options
  • Save kenton/4175959 to your computer and use it in GitHub Desktop.
Save kenton/4175959 to your computer and use it in GitHub Desktop.
[14] pry(main)> o = Operator.find(663)
=> #<Operator id: 663, account_number: "3AJ5", old_crc: "crc3095", legal_name: "All American Limo", dba_name: nil, reservation_phone_num: "(215) 535-5466", website: "http://www.535limo.com", state: "active", former_account_name: nil, url_slug: "all-american-limo-bensalem", center_of_service_comments: nil, signup_comments: nil, vehicle_limit: 20, num_insured_vehicles: 14, year_started: 2002, is_former_operator: true, can_reserve_24_7: true, is_nla_member: false, wants_enroll_more_than_one_cos: false, user_id: 676, created_at: "2003-06-23 00:00:00", updated_at: "2012-07-17 18:00:40", description: "At All American Limo we pride ourselves on customer...", msc: nil, email_preferences: 0, initial_account_load_amt: 99, initial_free_leads: 0, signup_promo_code: nil, relay_enabled: true, star_reviews_cache: #<BigDecimal:1142e74e8,'0.428E1',18(18)>, is_reservation_policies_accepted: true, is_reservation_tos_accepted: true, is_reservation_enabled: true, is_reservation_controls_visible: true, time_zone: "Eastern Time (US & Canada)", pm_details_release_days: 4, be_enabled_at: "2009-11-04 21:40:40", service_class: 1, limo_anywhere_enabled: true, limo_anywhere_api_id: "OHmN2F80y", limo_anywhere_api_key: "LtZ9GQgJE#", limo_anywhere_last_import: nil, limo_anywhere_conf: 1, drive_time_factor: #<BigDecimal:1142e5d50,'0.175E1',18(18)>, relay_html_content: true, green_ride_global_level: 0, seo_indexable: true, previous_state: nil, disabled_service_type_bits: 0, s_uuid: "SMQ", dispatch_api_enabled: nil, available_for_ondemand: false, cabulous_fleet_id: nil, cabulous_dispatch_id: nil, service_interest: nil>
[15] pry(main)> o.address
=> #<Address id: 2374924, street1: "4731 Hulmeville rd", street2: nil, city: "Bensalem", state_province: "PA", postal_code: "19020", country: "US", addressable_id: 663, addressable_type: "Operator", created_at: "2011-01-01 19:05:18", updated_at: "2012-11-29 21:00:04", description: nil, deleted_at: nil, place_id: nil, google_place_id: 11098586>
[16] pry(main)> o.address.google_place
=> #<GooglePlace id: 11098586, street_address: nil, full_address: "", city: nil, state_province: nil, postal_code: nil, country_code: nil, provider: nil, precision: "unknown", lat: nil, lng: nil, geocode_cache_query_id: nil, nearest_place_id: nil, created_at: "2012-11-29 21:00:04", place_name: nil>
[17] pry(main)> o.address.lat_lng
=> [nil, nil]
[18] pry(main)>
# Search#update_temp_ops
# something like this should keep this from happening and let us know which ops are an issue if this comes up again
ops.each do |op|
temp_op = real_ops_hash[op['operator_id'].to_i]
garage_lat_lng = temp_op.location_lat_lng
if garage_lat_lng.include?(nil)
puts "Op with address that returns bad latlng coords: #{temp_op.id}"
next
end
# remaining code...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment