Removed debug code and rewrote SQL as ORM query and readded icon image file

This commit is contained in:
Robb Ebright 2017-12-17 10:47:38 -05:00
parent a294d66383
commit ee86112898
3 changed files with 15 additions and 21 deletions

View File

@ -1057,7 +1057,6 @@ SQL;
$startsDT->setTimezone($displayTimezone); $startsDT->setTimezone($displayTimezone);
$endsDT->setTimezone($displayTimezone); $endsDT->setTimezone($displayTimezone);
xdebug_break();
$options["show_empty"] = (array_key_exists($show['instance_id'], $options["show_empty"] = (array_key_exists($show['instance_id'],
$content_count)) ? 0 : 1; $content_count)) ? 0 : 1;

View File

@ -237,9 +237,6 @@ SQL;
$ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0; $ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
$id = $this->_showInstance->getDbId(); $id = $this->_showInstance->getDbId();
$lastid = $this->getLastAudioItemId(); $lastid = $this->getLastAudioItemId();
// Logging::info("The last id is $lastid");
xdebug_break();
$scheduler = new Application_Model_Scheduler($checkUserPerm); $scheduler = new Application_Model_Scheduler($checkUserPerm);
$scheduler->scheduleAfter( $scheduler->scheduleAfter(
array(array("id" => $lastid, "instance" => $id, "timestamp" => $ts)), array(array("id" => $lastid, "instance" => $id, "timestamp" => $ts)),
@ -293,7 +290,6 @@ SQL;
private function checkToDeleteShow($showId) private function checkToDeleteShow($showId)
{ {
xdebug_break();
//UTC DateTime object //UTC DateTime object
$showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil(); $showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil();
@ -561,23 +557,22 @@ SQL;
public static function getShowHasAutoplaylist($p_start, $p_end) public static function getShowHasAutoplaylist($p_start, $p_end)
{ {
$sql = <<<SQL $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME);
SELECT c.id, s.has_autoplaylist $con->beginTransaction();
from cc_show_instances as c try {
LEFT JOIN cc_show as S ON s.id = c.show_id // query the show instances to find whether a show instance has an autoplaylist
WHERE ends > :p_start::TIMESTAMP $showInstances = CcShowInstancesQuery::create()
AND starts < :p_end::TIMESTAMP ->filterByDbEnds($p_end->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::LESS_THAN)
SQL; ->filterByDbStarts($p_start->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::GREATER_THAN)
$res = Application_Common_Database::prepareAndExecute($sql, array( ->leftJoinCcShow()
':p_start' => $p_start->format("Y-m-d G:i:s"), ->find($con);
':p_end' => $p_end->format("Y-m-d G:i:s")) return $showInstances;
, 'all'); }
$hasAutoplaylist = array(); catch (Exception $e) {
foreach ($res as $r) { $con->rollback();
$hasAutoplaylist[$r['id']] = $r['has_autoplaylist']; Logging::info("Couldn't query show instances for calendar to find which had autoplaylists");
Logging::info($e->getMessage());
} }
return $hasAutoplaylist;
} }
public function showEmpty() public function showEmpty()