Skip to content

Instantly share code, notes, and snippets.

View kenton's full-sized avatar

Kenton Newby kenton

View GitHub Profile
Spree::Sunspot::Setup.configure do
searchable auto_index: true,
auto_remove: true,
if: proc { |prod|
prod.variants.collect { |var|
var.flash_sales.size > 0 && var.flash_sales.any? { |fs| !fs.expired? }
}.any?
} do
Spree::Sunspot::Setup.configure do
searchable auto_index: true,
auto_remove: true,
if: proc { |prod|
prod.variants.collect { |var|
var.flash_sales.size > 0 && var.flash_sales.any? { |fs| !fs.expired? }
}.any?
} do
77) Error:
test_lead_status_for_search_with_force_biz_no_leads_'false'_and_API_bit_does_not_have_lead_status_of_BIZ_NO_LEADS_but_CUSTOMER+API(SearchTest):
ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'ride_flat_fee' in 'field list': CALL process_search( 4096, NULL, NULL, NULL, NULL, 0, NULL, 0, 2, 0, '1,2,3,4,5,6,7,9,10', NULL, -6, NULL, 0, 0, NULL, NULL, NULL, NULL, 0, 15.0 )
app/models/search.rb:392:in `execute'
/test/unit/search_test.rb:105:in `test_lead_status_for_search_with_force_biz_no_leads_'false'_and_API_bit_does_not_have_lead_status_of_BIZ_NO_LEADS_but_CUSTOMER+API'
<script type="text/javascript">
var grat_error="<%=t :rate_policy_grat_too_low_warn %>"; // gratuity error
var is_usca_rate=false;
<% if @operator.is_us_or_ca -%>
is_usca_rate=true;
<% end -%>
var operator_slug = "<%= @operator.url_slug%>";
var self_url_slug = '<%=@operator.url_slug%>'; // variables for building the edit url for the grid
var grid_edit_url = '/operators/'+self_url_slug+'/service_ports/update?'; // the url that update requests are sent to
[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_visi
~limos $ time thor stats:avg_ops_by_service_type -s 6/28/2012 -e 6/29/2012
Loading Configuration Settings!
Loading Configuration Settings from file: /Users/kentonnewby/dev/limos/config/application_configuration.yml
Loading Configuration Settings from file: /Users/kentonnewby/dev/limos/config/application_configuration_development.yml
there are '10578' matching searches. would you like to continue? (y to continue. anything else will exit script) y
Average Number of Operators By Service Type
SPORTING_EVENT: 30
WEDDING: 18
AIRPORT: -
connection = ActiveRecord::Base.connection
search = Search.last
in_search_mode = SEARCH_MODE_SUPER_SEARCH if search.is_super_search?
call_stmt = search.call_statement(in_search_mode)
connection.execute(call_stmt[0])
conn = search.class.connection
temp_table_operators = connection.select_value("SELECT @_table_operators")
ops = conn.select_all("SELECT operator_id FROM #{temp_table_operators}")
Loading Configuration Settings!
Loading Configuration Settings from file: /Users/kentonnewby/dev/limos/config/application_configuration.yml
Loading Configuration Settings from file: /Users/kentonnewby/dev/limos/config/application_configuration_development.yml
[1] pry(main)> .clear
[2] pry(main)> conn = ActiveRecord::Base.connection
=> #<ActiveRecord::ConnectionAdapters::MysqlAdapter:0x1067de6a8
@config=
{:adapter=>"mysql",
:username=>"root",
:password=>nil,
rp.total_discounts_amt = 0.0
rp.total_discounts_amt?
#=> false
so rp.total_discounts_amt? ? do_this_if_true : do_this_if_false
#=> always evaluates to do_this_if_false
but rp.total_discounts_amt.present? ? do_this_if_true : do_this_if_false
#=> will work as expected based on if value is present or nil
....
....
promo_code_requires_logged_in_user: "You must <a href='#' id='promo_code_passenger_details_link' class='register_link'>enter your passenger details</a> or <a href='#' id='promo_code_login_link'>login to your account</a> in order to apply this promo code."