deep voodoo magic to optimize schedule

This commit is contained in:
Rudi Grinberg 2012-10-19 11:32:35 -04:00
parent 58d00cb9b9
commit 8d56c03fe3
2 changed files with 24 additions and 2 deletions

View File

@ -1789,9 +1789,9 @@ SQL;
$showInstance = new Application_Model_ShowInstance(
$show["instance_id"]);
$showContent = $showInstance->getShowListContent();
//$showContent = $showInstance->getShowListContent();
$options["show_empty"] = empty($showContent) ? 1 : 0;
$options["show_empty"] = ($showInstance->showEmpty()) ? 1 : 0;
$events[] = &self::makeFullCalendarEvent($show, $options,
$startsDT, $endsDT, $startsEpochStr, $endsEpochStr);

View File

@ -661,6 +661,28 @@ SQL;
return $returnStr;
}
public function showEmpty()
{
$sql = <<<SQL
SELECT s.starts
FROM cc_schedule AS s
WHERE s.instance_id = :instance_id
AND s.playout_status >= 0
AND ((s.stream_id IS NOT NULL)
OR (s.file_id IS NOT NULL)) LIMIT 1
SQL;
# TODO : use prepareAndExecute properly
$res = Application_Common_Database::prepareAndExecute($sql,
array( ':instance_id' => $this->_instanceId ), 'all' );
# TODO : A bit retarded. fix this later
foreach ($res as $r) {
return false;
}
return true;
}
public function getShowListContent()
{
$con = Propel::getConnection();