Created
September 15, 2016 18:32
-
-
Save don-durrance/b6e14bf86bdc7dc9f8966ea94e3b8d55 to your computer and use it in GitHub Desktop.
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
{"Sale Date"=>"7/24/2016", | |
"Item price"=>"$30.00",}, | |
{"Sale Date"=>"7/24/2016", | |
"Item price"=>"$60.00",}, | |
{"Sale Date"=>"7/25/2016", | |
"Item price"=>"$10.00",}, | |
{"Sale Date"=>"7/25/2016", | |
"Item price"=>"$20.00",}, | |
etc... |
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
{"Sale Date"=>"7/24/2016", | |
"Client"=>"Amajor, Caitlin", | |
"Sale ID"=>"58198", | |
"Item name"=>"$30 for 30 (NEW STUDENTS ONLY)", | |
"Sales Notes"=>nil, | |
"Location"=>"Online Store", | |
"Notes"=>nil, | |
"Color"=>"---", | |
"Size"=>"---", | |
"Item price"=>"$30.00", | |
"Quantity"=>"1", | |
"Subtotal"=>"$30.00", | |
"Discount %"=>"0.00", | |
"Discount amount"=>"$0.00", | |
"Tax"=>"$0.00", | |
"Item Total"=>"$30.00", | |
"Total Paid w/ Payment Method"=>"$30.00", | |
"Payment Method"=>"Credit card (Visa/MC-Keyed)"}, |
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
def sort_by(key) | |
self.hash.sort_by{ |row| row[key] } | |
end | |
def sort_by_date_and(key) | |
hash = self.hash.sort_by{ |row| row["Sale Date"] } | |
# sorted by Sale Date, what now? | |
# Want to sort by date, and then within each date sort by another key such as "Item price" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment