From 61bab553ff7238bf352f2f4e97048a444e466cc1 Mon Sep 17 00:00:00 2001 From: Naomi Date: Fri, 11 Oct 2013 11:07:59 -0400 Subject: [PATCH 1/3] CC-5396 : Playout History: Restart airtime-liquidsoap will cause redundant items in history log --- .../application/services/HistoryService.php | 50 ++++++++++++------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/airtime_mvc/application/services/HistoryService.php b/airtime_mvc/application/services/HistoryService.php index 4b33ee698..98a8c0518 100644 --- a/airtime_mvc/application/services/HistoryService.php +++ b/airtime_mvc/application/services/HistoryService.php @@ -575,26 +575,38 @@ class Application_Service_HistoryService $instanceEnd = $showInstance->getDbEnds(null); $itemEnd = $item->getDbEnds(null); + $recordStart = $item->getDbStarts(null); $recordEnd = ($instanceEnd < $itemEnd) ? $instanceEnd : $itemEnd; - - $history = new CcPlayoutHistory(); - $history->setDbFileId($fileId); - $history->setDbStarts($item->getDbStarts(null)); - $history->setDbEnds($recordEnd); - $history->setDbInstanceId($item->getDbInstanceId()); - - foreach ($metadata as $key => $val) { - $meta = new CcPlayoutHistoryMetaData(); - $meta->setDbKey($key); - $meta->setDbValue($val); - - $history->addCcPlayoutHistoryMetaData($meta); - } - - $history->save($this->con); - } - - $this->con->commit(); + + //first check if this is a duplicate + // (caused by restarting liquidsoap) + + $prevRecord = CcPlayoutHistoryQuery::create() + ->filterByDbStarts($recordStart) + ->filterByDbEnds($recordEnd) + ->filterByDbFileId($fileId) + ->findOne($this->con); + + if (empty($prevRecord)) { + + $history = new CcPlayoutHistory(); + $history->setDbFileId($fileId); + $history->setDbStarts($recordStart); + $history->setDbEnds($recordEnd); + $history->setDbInstanceId($item->getDbInstanceId()); + + foreach ($metadata as $key => $val) { + $meta = new CcPlayoutHistoryMetaData(); + $meta->setDbKey($key); + $meta->setDbValue($val); + + $history->addCcPlayoutHistoryMetaData($meta); + } + + $history->save($this->con); + $this->con->commit(); + } + } } catch (Exception $e) { $this->con->rollback(); From 4c331aa9550c7af68d5f7ac400cbd6735177c4c4 Mon Sep 17 00:00:00 2001 From: Naomi Date: Fri, 11 Oct 2013 11:08:49 -0400 Subject: [PATCH 2/3] CRLF --- .../application/services/HistoryService.php | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/airtime_mvc/application/services/HistoryService.php b/airtime_mvc/application/services/HistoryService.php index 98a8c0518..c8ac571bc 100644 --- a/airtime_mvc/application/services/HistoryService.php +++ b/airtime_mvc/application/services/HistoryService.php @@ -589,20 +589,20 @@ class Application_Service_HistoryService if (empty($prevRecord)) { - $history = new CcPlayoutHistory(); - $history->setDbFileId($fileId); - $history->setDbStarts($recordStart); - $history->setDbEnds($recordEnd); - $history->setDbInstanceId($item->getDbInstanceId()); - - foreach ($metadata as $key => $val) { - $meta = new CcPlayoutHistoryMetaData(); - $meta->setDbKey($key); - $meta->setDbValue($val); - - $history->addCcPlayoutHistoryMetaData($meta); - } - + $history = new CcPlayoutHistory(); + $history->setDbFileId($fileId); + $history->setDbStarts($recordStart); + $history->setDbEnds($recordEnd); + $history->setDbInstanceId($item->getDbInstanceId()); + + foreach ($metadata as $key => $val) { + $meta = new CcPlayoutHistoryMetaData(); + $meta->setDbKey($key); + $meta->setDbValue($val); + + $history->addCcPlayoutHistoryMetaData($meta); + } + $history->save($this->con); $this->con->commit(); } From 5defb12430572dfeed2f925553dcd8582c3af434 Mon Sep 17 00:00:00 2001 From: Naomi Date: Fri, 11 Oct 2013 11:53:53 -0400 Subject: [PATCH 3/3] CC-5398 : "Add Show" does not update calender "orange" progress bar immediately showing content is added until refresh page or different view. --- airtime_mvc/public/js/airtime/schedule/schedule.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/public/js/airtime/schedule/schedule.js b/airtime_mvc/public/js/airtime/schedule/schedule.js index 69f3b900d..f28e405eb 100644 --- a/airtime_mvc/public/js/airtime/schedule/schedule.js +++ b/airtime_mvc/public/js/airtime/schedule/schedule.js @@ -13,8 +13,13 @@ var AIRTIME = (function(AIRTIME){ var serverTimezoneOffset = 0; function closeDialogCalendar(event, ui) { - //$("#schedule_calendar").fullCalendar( 'refetchEvents' ); - $(this).remove(); + + $el = $(this); + $el.dialog('destroy'); + $el.remove(); + + //need to refetch the events to update scheduled status. + $("#schedule_calendar").fullCalendar( 'refetchEvents' ); } function checkShowLength(json) {