Skip to content

Instantly share code, notes, and snippets.

@iamajvillalobos
Last active July 18, 2017 06:49
Show Gist options
  • Save iamajvillalobos/027ace47f512985eb1bf786360e37548 to your computer and use it in GitHub Desktop.
Save iamajvillalobos/027ace47f512985eb1bf786360e37548 to your computer and use it in GitHub Desktop.
# How to group this collection so that Clover::Order will be grouped by every 15 mins
{
Sun, 09 Jul 2017 => [
#<Clover::Order:0x007f82efc7a758
@created_time=2017-07-10 00:15:00 +0800,
@id="5CY4WQG1XWJK1",
@state="paid",
@total=1234>,
#<Clover::Order:0x007f82efc6b550
@created_time=2017-07-10 00:18:00 +0800,
@id="5CY4WQG1XJK11",
@state="paid",
@total=1234>,
#<Clover::Order:0x007f82efc61f28
@created_time=2017-07-10 00:30:00 +0800,
@id="5CY4WQG1XWJK2",
@state="paid",
@total=4567>,
#<Clover::Order:0x007f82ef801f00
@created_time=2017-07-10 00:45:00 +0800,
@id="5CY4WQG1XWJK2",
@state="paid",
@total=8901>],
Tue, 11 Jul 2017 => [
#<Clover::Order:0x007f82efc53db0
@created_time=2017-07-11 12:25:00 +0800,
@id="5CY4WQG1XWJK1",
@state="paid",
@total=1234>,
#<Clover::Order:0x007f82efc49d60
@created_time=2017-07-11 12:30:00 +0800,
@id="5CY4WQG1XWJK1",
@state="paid",
@total=1234>],
Thu, 13 Jul 2017 => [
#<Clover::Order:0x007f82efc3b8f0
@created_time=2017-07-13 12:50:00 +0800,
@id="5CY4WQG1XWJK1",
@state="paid",
@total=1234>
]
}
# End result
{
Sun, 09 Jul 2017 => [
[
#<Clover::Order:0x007f82efc7a758
@created_time=2017-07-10 00:15:00 +0800,
@id="5CY4WQG1XWJK1",
@state="paid",
@total=1234>,
],
[
#<Clover::Order:0x007f82efc6b550
@created_time=2017-07-10 00:18:00 +0800,
@id="5CY4WQG1XJK11",
@state="paid",
@total=1234>,
#<Clover::Order:0x007f82efc61f28
@created_time=2017-07-10 00:30:00 +0800,
@id="5CY4WQG1XWJK2",
@state="paid",
@total=4567>,
],
[
#<Clover::Order:0x007f82ef801f00
@created_time=2017-07-10 00:45:00 +0800,
@id="5CY4WQG1XWJK2",
@state="paid",
@total=8901>
]
],
Tue, 11 Jul 2017 => [
#<Clover::Order:0x007f82efc53db0
@created_time=2017-07-11 12:25:00 +0800,
@id="5CY4WQG1XWJK1",
@state="paid",
@total=1234>,
#<Clover::Order:0x007f82efc49d60
@created_time=2017-07-11 12:30:00 +0800,
@id="5CY4WQG1XWJK1",
@state="paid",
@total=1234>
],
Thu, 13 Jul 2017 => [
#<Clover::Order:0x007f82efc3b8f0
@created_time=2017-07-13 12:50:00 +0800,
@id="5CY4WQG1XWJK1",
@state="paid",
@total=1234
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment