Initial proof of concept for time remaining smart block limit

This commit is contained in:
Robbt 2018-11-24 17:08:39 -05:00
parent 6031d95351
commit c759f8b8aa
4 changed files with 33 additions and 7 deletions

View file

@ -1310,9 +1310,13 @@ SQL;
}
}
public function getListOfFilesUnderLimit()
/*
*
*/
public function getListOfFilesUnderLimit($show = null)
{
$info = $this->getListofFilesMeetCriteria();
$info = $this->getListofFilesMeetCriteria($show);
$files = $info['files'];
$limit = $info['limit'];
$repeat = $info['repeat_tracks'];
@ -1467,7 +1471,7 @@ SQL;
}
// this function return list of propel object
public function getListofFilesMeetCriteria()
public function getListofFilesMeetCriteria($show = null)
{
$storedCrit = $this->getCriteria();
@ -1605,6 +1609,17 @@ SQL;
if ($storedCrit['limit']['modifier'] == "items") {
$limits['time'] = 1440 * 60;
$limits['items'] = $storedCrit['limit']['value'];
} elseif (($storedCrit['limit']['modifier'] == "remaining") ){
// show will be null unless being called inside a show instance
if (!(is_null($show))) {
$showInstance = new Application_Model_ShowInstance($show);
$limits['time'] = $showInstance->getSecondsRemaining();
$limits['items'] = null;
}
else {
$limits['time'] = 1440 * 60;
$limits['items'] = null;
}
} else {
$limits['time'] = $storedCrit['limit']['modifier'] == "hours" ?
intval(floatval($storedCrit['limit']['value']) * 60 * 60) :