From ee861128988e0bbba4c3599e67695bd0f7275637 Mon Sep 17 00:00:00 2001 From: Robb Ebright Date: Sun, 17 Dec 2017 10:47:38 -0500 Subject: [PATCH] Removed debug code and rewrote SQL as ORM query and readded icon image file --- airtime_mvc/application/models/Show.php | 1 - .../application/models/ShowInstance.php | 35 ++++++++---------- .../images/icon_alert_cal_autoplaylist.png | Bin 568 -> 571 bytes 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 45100eb66..692a6b387 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1057,7 +1057,6 @@ SQL; $startsDT->setTimezone($displayTimezone); $endsDT->setTimezone($displayTimezone); - xdebug_break(); $options["show_empty"] = (array_key_exists($show['instance_id'], $content_count)) ? 0 : 1; diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index 313c2b059..c219637fa 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -237,9 +237,6 @@ SQL; $ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0; $id = $this->_showInstance->getDbId(); $lastid = $this->getLastAudioItemId(); -// Logging::info("The last id is $lastid"); - xdebug_break(); - $scheduler = new Application_Model_Scheduler($checkUserPerm); $scheduler->scheduleAfter( array(array("id" => $lastid, "instance" => $id, "timestamp" => $ts)), @@ -293,7 +290,6 @@ SQL; private function checkToDeleteShow($showId) { - xdebug_break(); //UTC DateTime object $showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil(); @@ -561,23 +557,22 @@ SQL; public static function getShowHasAutoplaylist($p_start, $p_end) { - $sql = << :p_start::TIMESTAMP -AND starts < :p_end::TIMESTAMP -SQL; - $res = Application_Common_Database::prepareAndExecute($sql, array( - ':p_start' => $p_start->format("Y-m-d G:i:s"), - ':p_end' => $p_end->format("Y-m-d G:i:s")) - , 'all'); - $hasAutoplaylist = array(); - foreach ($res as $r) { - $hasAutoplaylist[$r['id']] = $r['has_autoplaylist']; + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME); + $con->beginTransaction(); + try { + // query the show instances to find whether a show instance has an autoplaylist + $showInstances = CcShowInstancesQuery::create() + ->filterByDbEnds($p_end->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::LESS_THAN) + ->filterByDbStarts($p_start->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::GREATER_THAN) + ->leftJoinCcShow() + ->find($con); + return $showInstances; + } + catch (Exception $e) { + $con->rollback(); + Logging::info("Couldn't query show instances for calendar to find which had autoplaylists"); + Logging::info($e->getMessage()); } - - return $hasAutoplaylist; } public function showEmpty() diff --git a/airtime_mvc/public/css/images/icon_alert_cal_autoplaylist.png b/airtime_mvc/public/css/images/icon_alert_cal_autoplaylist.png index 44e56e0d3aa6b0c2a712fef3c58779231b66c053..5398cb9c5ab1558dfb092ac27ab89a4827199b5f 100644 GIT binary patch delta 500 zcmVRsB00GHKL_t(2&sEDmXcJKY$MN5Lmy373e@U+u zktU*;>QFE)I#jWgDqS30)Tu%jp^Hl=@eg&$;4J9k;OdeNl29@zl?pD=!T+F5rD}U= z{#@^Jxp#N(xx|3q^~;A~(8`-Tw9;7B59<@BT0!%I7kODt)_>el#eU1;a3g2r_aDza zH;V6Wk!vq5AOGC`_$}r!1Q+0; zfTU6YK(NWscz?J9-s3p=BoCSH-2rQ3X{9y!Qb!nF9$%*}l zmJ)Okr-BqMLQxO}BRc3%6$PDK#90LY04HZR2gL@2iim9p)XC@)B%8JlrcKo(rfu%> zad)}9*TsrH^ADaMkKiBjuTIN$qkZK2yT+ZNA7nF!QeXBTw|@$giR|a4i^UM2R4Pdw z;L_`}qSbGl+pxbq8SHww&BZ1F+mkkOMm=VRq@oGi>%5(ParEwhek9MloXhNZ+aLBW)*d&B=L|A)N&0IZk*i40 zCIIjwFK-&=ihtG{_AV$C0G)CVLWoTpjOEkFq=xgUPvk`aC>2rnYWKB31(`idyJUj^ zIVy0shDcK*@)ezry*~>!qGC6Q#ACadJhG6YpoxxWhw`%TV9ZtVLW}J8~*B5KboJhWL zTi${&g*ARTC8VVxVt@|Pl!U!drE_LAnhNKy#IFaUQmMprp~ruP&D2t>@TloFuJJ!= nDn9+}YWC)XQId|`?Tr5hI5*BKDOc3200000NkvXXu0mjfc53TM