Skip to content

Instantly share code, notes, and snippets.

@marcoslebron
Created May 4, 2017 04:21
Show Gist options
  • Save marcoslebron/b0f8b4c353d20082a52dc4d4c2486c2b to your computer and use it in GitHub Desktop.
Save marcoslebron/b0f8b4c353d20082a52dc4d4c2486c2b to your computer and use it in GitHub Desktop.
def outstanding_totals
Invoice.with_state(:sent).to_a.sum(&:total_cents)
end
def drafted_totals
Invoice.with_state(:drafted).to_a.sum(&:total_cents)
end
def paid_totals
Invoice.with_state(:paid).to_a.sum(&:total_cents)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment