I have an array full of events with a date field. I wanted to sort the array by the date field, but then after this is sorted, shuffle the events within each day (but still maintaining the date order):
@events = Event.order('date desc').shuffle....?
This is an example of what I want:
Array:
[
Event 1 (Jan. 2),
Event 2 (Jan. 1),
Event 3 (Jan. 3),
Event 4 (Jan. 1),
Event 5 (Jan. 3)
]
On one request, I want this order:
Event 2, Event 4, Event 1, Event 3, Event 5
But, on another request, a different random order:
Event 4, Event 2, Event 1, Event 5, Event 3
On each request I want a similar variation that maintains the date order, but shuffles events within each day.