Skip to content

Instantly share code, notes, and snippets.

@bogdan
Created November 7, 2016 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bogdan/28d7f2a39266fd35417089816be00f23 to your computer and use it in GitHub Desktop.
Save bogdan/28d7f2a39266fd35417089816be00f23 to your computer and use it in GitHub Desktop.
> r!;ShareEmail.perform(Offer.last, 'A A <alexey.vlasov@gmail.com>', nil, nil, nil, nil)
Reloading...
Offer Load (0.3ms) SELECT `offers`.* FROM `offers` ORDER BY `offers`.`id` DESC LIMIT 1
Campaign Load (0.3ms) SELECT `campaigns`.* FROM `campaigns` WHERE `campaigns`.`id` = 37228 LIMIT 1
Site Load (0.3ms) SELECT `sites`.* FROM `sites` WHERE `sites`.`id` = 2901 LIMIT 1
Person Load (0.3ms) SELECT `people`.* FROM `people` WHERE `people`.`site_id` = 2901 AND `people`.`email` = 'alexey.vlasov@gmail.com'
CustomAttribute Load (0.3ms) SELECT `custom_attributes`.* FROM `custom_attributes` WHERE `custom_attributes`.`foreign_id` = 18425477 AND `custom_attributes`.`model` = 'Person'
Mailgun Batch Email Validation: passed - 1, failed - 0, total - 1
Account Load (0.2ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 4416 LIMIT 1
Person Load (0.5ms) SELECT `people`.* FROM `people` INNER JOIN `offer_shares` ON `people`.`id` = `offer_shares`.`person_id` WHERE `offer_shares`.`type` IN ('EmailOfferShare') AND `offer_shares`.`offer_id` = 29823582
Person Load (0.2ms) SELECT `people`.* FROM `people` WHERE `people`.`id` = 18425429 LIMIT 1
Site Load (0.2ms) SELECT `sites`.* FROM `sites` WHERE `sites`.`id` = 2901 LIMIT 1
Account Load (0.2ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 4416 LIMIT 1
Origin Load (0.2ms) SELECT `origins`.* FROM `origins` WHERE `origins`.`id` = 44435893 LIMIT 1
(0.2ms) BEGIN
SQL (0.3ms) INSERT INTO `share_emails` (`offer_id`, `recipients`, `created_at`, `updated_at`) VALUES (29823582, '[]', '2016-11-07 15:23:11', '2016-11-07 15:23:11')
(0.1ms) COMMIT
Offer Load (0.3ms) SELECT `offers`.* FROM `offers` WHERE `offers`.`id` = 29823582 LIMIT 1
Campaign Load (0.2ms) SELECT `campaigns`.* FROM `campaigns` WHERE `campaigns`.`id` = 37228 LIMIT 1
Site Load (0.2ms) SELECT `sites`.* FROM `sites` WHERE `sites`.`id` = 2901 LIMIT 1
(0.3ms) SELECT `campaign_tags`.`name` FROM `campaign_tags` WHERE `campaign_tags`.`campaign_id` = 37228
CustomAttribute Load (0.3ms) SELECT `custom_attributes`.* FROM `custom_attributes` WHERE `custom_attributes`.`foreign_id` = 37228 AND `custom_attributes`.`model` = 'Campaign'
Origin Load (0.2ms) SELECT `origins`.* FROM `origins` WHERE `origins`.`id` = 44435893 LIMIT 1
Person Load (0.2ms) SELECT `people`.* FROM `people` WHERE `people`.`id` = 18425429 LIMIT 1
WebHook Load (0.2ms) SELECT `web_hooks`.* FROM `web_hooks` WHERE `web_hooks`.`site_id` = 2901 AND `web_hooks`.`key` = 'post_share_web_hook' ORDER BY `web_hooks`.`id` ASC LIMIT 1
CustomAttribute Load (0.2ms) SELECT `custom_attributes`.* FROM `custom_attributes` WHERE `custom_attributes`.`foreign_id` = 37228 AND `custom_attributes`.`model` = 'Campaign'
Visitor Load (0.2ms) SELECT `visitors`.* FROM `visitors` WHERE `visitors`.`id` = 54179956 LIMIT 1
VisitorUserAgent Load (0.2ms) SELECT `visitor_user_agents`.* FROM `visitor_user_agents` WHERE `visitor_user_agents`.`id` = 270541 LIMIT 1
Incentive Load (0.6ms) SELECT `incentives`.* FROM `incentives` WHERE `incentives`.`campaign_id` IN (37228) ORDER BY field(incentives.type, "SignupIncentive","SharingIncentive","ReferrerIncentive","ClickIncentive","ReferredIncentive"), incentives.id asc
(0.4ms) SELECT COUNT(*) FROM `offer_shares` WHERE `offer_shares`.`type` IN ('EmailOfferShare') AND `offer_shares`.`offer_id` = 29823582
=> {:coupon_code=>nil,
:previous_recipients=>["palexvs@gmail.com", "test@test.com", "testt@test.com", "alexey.vlasov@gmail.com"],
:current_recipients=>["alexey.vlasov@gmail.com"],
:sent_recipients=>[],
:recipients_count=>4}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment