Try to fix some schedule bugs
This commit is contained in:
parent
d4d152c670
commit
553299e9f5
|
@ -1572,6 +1572,9 @@ class Application_Model_Preference
|
||||||
self::setValue("station_podcast_download_counter", empty($c) ? 0 : --$c);
|
self::setValue("station_podcast_download_counter", empty($c) ? 0 : --$c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int either 0 (public) or 1 (private)
|
||||||
|
*/
|
||||||
public static function getStationPodcastPrivacy() {
|
public static function getStationPodcastPrivacy() {
|
||||||
if (!Billing::isStationPodcastAllowed()) {
|
if (!Billing::isStationPodcastAllowed()) {
|
||||||
// return private setting
|
// return private setting
|
||||||
|
|
|
@ -482,10 +482,15 @@ class Application_Model_Scheduler
|
||||||
->orderByDbStarts()
|
->orderByDbStarts()
|
||||||
->find($this->con);
|
->find($this->con);
|
||||||
|
|
||||||
|
$now = new DateTime("now", new DateTimeZone("UTC"));
|
||||||
$itemStartDT = $instance->getDbStarts(null);
|
$itemStartDT = $instance->getDbStarts(null);
|
||||||
foreach ($schedule as $item) {
|
foreach ($schedule as $item) {
|
||||||
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
|
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
|
||||||
Logging::info($itemEndDT);
|
// If the track has already ended, don't change it.
|
||||||
|
if ($itemEndDT < $now) {
|
||||||
|
$itemStartDT = $itemEndDT;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$item->setDbStarts($itemStartDT)
|
$item->setDbStarts($itemStartDT)
|
||||||
->setDbEnds($itemEndDT)
|
->setDbEnds($itemEndDT)
|
||||||
->save($this->con);
|
->save($this->con);
|
||||||
|
@ -515,10 +520,15 @@ class Application_Model_Scheduler
|
||||||
->orderByDbStarts()
|
->orderByDbStarts()
|
||||||
->find($this->con);
|
->find($this->con);
|
||||||
|
|
||||||
|
$now = new DateTime("now", new DateTimeZone("UTC"));
|
||||||
$itemStartDT = $instance->getDbStarts(null);
|
$itemStartDT = $instance->getDbStarts(null);
|
||||||
foreach ($schedule as $item) {
|
foreach ($schedule as $item) {
|
||||||
|
|
||||||
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
|
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
|
||||||
|
// If the track has already ended, don't change it.
|
||||||
|
if ($itemEndDT < $now) {
|
||||||
|
$itemStartDT = $itemEndDT;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$item->setDbStarts($itemStartDT)
|
$item->setDbStarts($itemStartDT)
|
||||||
->setDbEnds($itemEndDT);
|
->setDbEnds($itemEndDT);
|
||||||
|
@ -1191,7 +1201,7 @@ class Application_Model_Scheduler
|
||||||
|
|
||||||
foreach ($removedItems as $removedItem) {
|
foreach ($removedItems as $removedItem) {
|
||||||
$instance = $removedItem->getCcShowInstances($this->con);
|
$instance = $removedItem->getCcShowInstances($this->con);
|
||||||
$effectedInstanceIds[] = $instance->getDbId();
|
$effectedInstanceIds[$instance->getDbId()] = $instance->getDbId();
|
||||||
|
|
||||||
//check if instance is linked and if so get the schedule items
|
//check if instance is linked and if so get the schedule items
|
||||||
//for all linked instances so we can delete them too
|
//for all linked instances so we can delete them too
|
||||||
|
|
Loading…
Reference in New Issue