advance time better

This commit is contained in:
Seth Call 2021-03-16 08:35:47 -05:00
parent 9a0c70517b
commit ad7a02746b
2 changed files with 6 additions and 4 deletions

View File

@ -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!

View File

@ -8,7 +8,7 @@ module JamRuby
def self.perform
@@log.debug("waking up")
LessonSession.minutely_check
#LessonSession.minutely_check
@@log.debug("done")
end