asp.net mvc - Aggregate 15 minute time slots to 30 minutes time slots -
i have list of time slots 15 minute interval. each slot can have activity bound makes slot "reserved".
what best way return slots in groups of 30 minutes.
so basically, how can go this:
10:00
10:15 = this reserved slot
10:30
to this:
10:00
10:30
this whole slot reserved because contains reserved 10:15 slot.
without changing slot size itself.
is possible within linq query or have return collection of 15 minute slots , apply 30 minute logic afterwards?
please point me in right direction, thanks!
the slots object these properties , types:
timeslotid (int) slotstart (datetime) activityid (int) update:
ok, tried group slots query.
var groups = service.testgrouping().groupby(x => { var stamp = x.slotstart; stamp = stamp.addminutes(-(stamp.minute % 30)); stamp = stamp.addmilliseconds(-stamp.millisecond - 1000 * stamp.second); return stamp; }).select(g => new sample() { grouptime = g.key, groupedslots = g.tolist() }).tolist(); which takes me little closer. slots aggregated closest 30 minute, 8:00-8:30, 8:30-9:00.
however, not work slots within quarter / quarter past. need logic catch possible half hours:
8:00-8:30, 8:15-8:45, 8:30-9:00, 8:45-9:15.
how logic like?
Comments
Post a Comment