trms / wp-cablecast

A Wordpress plugin for Cablecast
GNU General Public License v3.0
2 stars 6 forks source link

Schedule conflicts #17

Closed bryanharley closed 2 years ago

bryanharley commented 5 years ago

If I update scheduled items in Cablecast that have already been synced to WordPress, you can end up with duplicate schedule items on WordPress.

For example, Show A is scheduled for 6pm in Cablecast. It gets synced to WordPress. Now I change the schedule in Cablecast so Show B is at 6pm. When this syncs to WordPress it results in both Show A and Show B displaying on the schedule page at 6pm.

raytiley commented 5 years ago

https://github.com/raytiley/wp-cablecast/blob/master/includes/sync.php#L353

When an item is deleted from the schedule it should be returned as a deleted record and deleted from wordpress ^^

Does this only happen f the run is changed last minute? How often does your cron run to sync?

bryanharley commented 5 years ago

Huh, weird. Cron runs every hour between 7am and 10pm. So it should be deleting it. But for example, look at 8pm: https://cmac.tv/channel/cmac-1/?schedule_date=2019-06-18

raytiley commented 4 years ago

My best guess is that on systems with multiple channels and lots of runs the sync logic for the schedule might be too naive

We basically try to load max 500 runs starting from two days ago. Might need to make this a bit smarter and page through results like when syncing shows.

https://github.com/raytiley/wp-cablecast/blob/master/includes/sync.php#L16-L18

bryanharley commented 4 years ago

Another example, look at 5pm: https://cmac.tv/channel/cmac-1/?schedule_date=2020-06-23

"Two Guys Talkin' Fresno: Ep 65" was originally scheduled for 5pm. I deleted that run, and all other runs until 9pm. But they're still showing on the website schedule.

I replaced those runs with a new show "Fresno Housing Authority Board Meeting", which runs for 4 hours, 5pm to 8:59pm.

The cron has run several times since I made this change, but the originally scheduled shows from 5 to 9pm are never deleted.

bryanharley commented 2 years ago

Fixed by the 2nd commit, https://github.com/trms/wp-cablecast/pull/31. Thanks!