CC-4904: Library -> Sort by status doesn't work

- added 2 columns to cc_files (is_scheduled, is_playlist)
- split library status column into two columns (scheduled, playlist)
- is_scheduled gets updated when a track plays out, or when a file gets added/removed from/to a show
- is_playlist gets updated when a file gets added/removed from/to a playlist/block, when a playlist/block gets deleted, or when a playlist/block's contents is cleared
This commit is contained in:
denise 2013-02-01 17:47:07 -05:00
parent 384298f680
commit 8309593a0f
14 changed files with 376 additions and 59 deletions

View file

@ -514,6 +514,13 @@ class Application_Model_Scheduler
$instance->updateScheduleStatus($this->con);
}
// update is_scheduled flag for each cc_file
foreach ($schedFiles as $file) {
$db_file = CcFilesQuery::create()->findPk($file['id'], $this->con);
$db_file->setDbIsScheduled(true);
$db_file->save($this->con);
}
$endProfile = microtime(true);
Logging::debug("updating show instances status.");
Logging::debug(floatval($endProfile) - floatval($startProfile));
@ -718,6 +725,16 @@ class Application_Model_Scheduler
} else {
$removedItem->delete($this->con);
}
// update is_scheduled in cc_files but only if
// the file is not scheduled somewhere else
$fileId = $removedItem->getDbFileId();
// check if the removed item is scheduled somewhere else
$futureScheduledFiles = Application_Model_Schedule::getAllFutureScheduledFiles();
if (!is_null($fileId) && !in_array($fileId, $futureScheduledFiles)) {
$db_file = CcFilesQuery::create()->findPk($fileId, $this->con);
$db_file->setDbIsScheduled(false)->save($this->con);
}
}
if ($adjustSched === true) {