Baed invite rewards on settlement date

Stephen Paul Weber created

Not just raw creation date. This way eg BTC transactions reward sooner.

Change summary

bin/process_invite_rewards | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Detailed changes

bin/process_invite_rewards 🔗

@@ -36,7 +36,7 @@ QUERY = <<~SQL
 	WHERE rewarded_at IS NULL AND used_by_id IS NOT NULL AND amount > 0
 	GROUP BY used_by_id, code, creator_id, plan_name
 	HAVING
-		MIN(transactions.created_at) < LOCALTIMESTAMP - '90 days'::interval
+		MIN(transactions.settled_after) < LOCALTIMESTAMP - '2 days'::interval
 		AND
 		SUM(transactions.amount) >= 15
 SQL