From ad7a02746b6bb07738878613d0a19847fb34fd40 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Tue, 16 Mar 2021 08:35:47 -0500 Subject: [PATCH] advance time better --- ruby/lib/jam_ruby/recurly_client.rb | 8 +++++--- ruby/lib/jam_ruby/resque/scheduled/minutely_job.rb | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ruby/lib/jam_ruby/recurly_client.rb b/ruby/lib/jam_ruby/recurly_client.rb index 960321d4b..4c364dbd9 100644 --- a/ruby/lib/jam_ruby/recurly_client.rb +++ b/ruby/lib/jam_ruby/recurly_client.rb @@ -653,6 +653,11 @@ module JamRuby next end + # advance the time last seen in the transactions. + if latest_seen.nil? || latest_seen < transaction.created_at.to_time + latest_seen = transaction.created_at.to_time + end + # these next lines try to ascertain that the transaction we've hit describes a true subscription # jamtrack transactions are handled entirely separately, so this should avoid those, and perhaps other 'odd' # transactions in Recurly @@ -671,9 +676,6 @@ module JamRuby fee_in_cents = transaction.amount_in_cents * affiliate_partner.rate affiliate_distribution.affiliate_referral_fee_in_cents = fee_in_cents affiliate_distribution.created_at = transaction.created_at.to_time - if latest_seen.nil? || latest_seen < transaction.created_at.to_time - latest_seen = transaction.created_at.to_time - end affiliate_distribution.product_code = subscription.plan.plan_code affiliate_distribution.external_id = transaction.uuid #external_id is a unique column. should raises error if duplicates affiliate_distribution.save! diff --git a/ruby/lib/jam_ruby/resque/scheduled/minutely_job.rb b/ruby/lib/jam_ruby/resque/scheduled/minutely_job.rb index ad9df11a3..d12766ea8 100644 --- a/ruby/lib/jam_ruby/resque/scheduled/minutely_job.rb +++ b/ruby/lib/jam_ruby/resque/scheduled/minutely_job.rb @@ -8,7 +8,7 @@ module JamRuby def self.perform @@log.debug("waking up") - LessonSession.minutely_check + #LessonSession.minutely_check @@log.debug("done") end