object @quarterly

attribute :closed, :paid, :due_amount_in_cents, :affiliate_partner_id, :quarter, :month, :year, :payment_type, :jamtracks_sold

node (:subscriptions) do |payment|
  start_at = Date.new(payment.year, payment.month, 1)
  end_at = Date.new(payment.year, payment.month, 1).end_of_month
  AffiliateDistribution.subscription_plans_count(payment.affiliate_partner_id, start_at, end_at)
end