Hi,
My question is a bit of wonder and a bit of enlightment.
I have two models, Channel and ChannelItem, the second is a list of
Events, ordered by position (because I’m using acts_as_list).
Later I use a method in Channel to recalculate the hour when that show
come online, based on the duration of it and doing math based on the
previous one duration and start time, starting from 0:00.
So, with this info (channel_items):
id | channel_id | event_id | position | starttime
1 | 1 | 3 | 1 |
2 | 1 | 5 | 2 |
3 | 1 | 2 | 3 |
4 | 1 | 1 | 4 |
[…]
After processing it with recalculate_hours get this (all starting
00:00):
id | channel_id | event_id | position | starttime
1 | 1 | 3 | 1 | 00:00 (event.duration = 1:00)
2 | 1 | 5 | 2 | 01:00 (event.duration = 0:30)
3 | 1 | 2 | 3 | 01:30 (event.duration = 0:45)
4 | 1 | 1 | 4 | 02:15 (event.duration = 0:30)
[…]
Ok, Every time I rearrange the schedule (the channel information), need
to call recalculate method, which is a bit expensive to do for 24hs
schedules
How could I implement this methods as “acts” so remove the dependency on
acts_as_list and use my own? also if I could get “next available
position” as time instead of integer?
Hope the question is clear, and hope someone could enlight me in the
right direction.
Regards,
Luis