What event am I paying for?
weekend = Event.last.weekend
What characters have professions?
characters = Talent.where(group: "Profession").map(&:character).uniq
Have they bought upkeep this event?
upkeeps = characters.map { |c| BankTransaction.where(from_account_id: c.bank_accounts.first).where(created_at: weekend-1.month..weekend+1.month).where('memo ilike ?', '%upkeep%') }.flatten
What event am I paying for?
weekend = Event.last.weekend
What characters have professions?characters = Talent.where(group: "Profession").map(&:character).uniq
Have they bought upkeep this event?upkeeps = characters.map { |c| BankTransaction.where(from_account_id: c.bank_accounts.first).where(created_at: weekend-1.month..weekend+1.month).where('memo ilike ?', '%upkeep%') }.flatten