Skip to content

Instantly share code, notes, and snippets.

@alkema
Created December 15, 2015 03:52
Show Gist options
  • Save alkema/80e86c49b3bac1cbb0bd to your computer and use it in GitHub Desktop.
Save alkema/80e86c49b3bac1cbb0bd to your computer and use it in GitHub Desktop.
irb(main):003:0> reload!; puts MerchantDirectory::Activity.fully_provisionable.count
Reloading...
Creating scope :published. Overwriting existing method MerchantDirectory::Activity.published.
Creating scope :published. Overwriting existing method MerchantDirectory::Profile.published.
(143.1ms) SELECT DISTINCT COUNT(DISTINCT `merchant_directory_activities`.`id`) FROM `merchant_directory_activities` INNER JOIN merchant_directory_variants ON merchant_directory_variants.merchant_activity_id = merchant_directory_activities.id INNER JOIN merchant_directory_availability_rules ON merchant_directory_availability_rules.merchant_variant_id = merchant_directory_variants.id WHERE (merchant_directory_activities.confero_id IS NOT NULL) AND (merchant_directory_variants.advance_product_id is null) AND (merchant_directory_variants.price IS NOT NULL) AND (merchant_directory_variants.duration < 86400) AND (merchant_directory_availability_rules.start_date is not NULL) AND (merchant_directory_availability_rules.end_date is not NULL) AND (merchant_directory_availability_rules.valid_days != '[]') AND (merchant_directory_availability_rules.start_time is not null)
3125
=> nil
irb(main):004:0> puts MerchantDirectory::Profile.fully_provisionable.count
(117.8ms) SELECT DISTINCT COUNT(DISTINCT `merchant_directory_profiles`.`id`) FROM `merchant_directory_profiles` INNER JOIN merchant_directory_activities ON merchant_directory_activities.merchant_profile_id = merchant_directory_profiles.id INNER JOIN merchant_directory_variants ON merchant_directory_variants.merchant_activity_id = merchant_directory_activities.id INNER JOIN merchant_directory_availability_rules ON merchant_directory_availability_rules.merchant_variant_id = merchant_directory_variants.id WHERE (merchant_directory_profiles.advance_account_uuid is NULL) AND (merchant_directory_activities.confero_id IS NOT NULL) AND (merchant_directory_variants.advance_product_id is null) AND (merchant_directory_variants.price IS NOT NULL) AND (merchant_directory_variants.duration < 86400) AND (merchant_directory_availability_rules.start_date is not NULL) AND (merchant_directory_availability_rules.end_date is not NULL) AND (merchant_directory_availability_rules.valid_days != '[]') AND (merchant_directory_availability_rules.start_time is not null)
1256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment