Last active
December 18, 2015 10:09
-
-
Save airspeed/5766143 to your computer and use it in GitHub Desktop.
Schweizer bestellte Anzahl mit Datumfilter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OrderItem.where(:created_at => Date.parse('2013-04-01')..Date.parse('2013-07-31')).select{|b| b.address.country_code == "CH"}.map(&:quantity).sum | |
# noch flexibler | |
OrderItem.where(:created_at => Date.parse('2013-04-01')..Date.today).select{|b| b.address.country_code == "CH"}.map(&:quantity).sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment