Added comments and removed some unused code

This commit is contained in:
drigato 2014-10-15 17:11:38 -04:00
parent 660b1a0596
commit 2a2b4bd05a
1 changed files with 14 additions and 4 deletions

View File

@ -150,10 +150,20 @@ class Application_Service_SchedulerService
return $dt; return $dt;
} }
/**
*
* Gets a copy of the linked show's schedule from cc_schedule table
* The schedule is taken from the most recent show instance that existed
* before new show instances were created.
*
* @param integer $showId
* @param array $instancsIdsToFill
*/
public static function getLinkedShowSchedule($showId, $instancsIdsToFill) public static function getLinkedShowSchedule($showId, $instancsIdsToFill)
{ {
$showsPopulatedUntil = Application_Model_Preference::GetShowsPopulatedUntil(); $showsPopulatedUntil = Application_Model_Preference::GetShowsPopulatedUntil();
$showInstanceWithMostRecentSchedule = CcShowInstancesQuery::create() $showInstanceWithMostRecentSchedule = CcShowInstancesQuery::create()
->filterByDbShowId($showId) ->filterByDbShowId($showId)
->filterByDbStarts($showsPopulatedUntil->format("Y-m-d H:i:s"), Criteria::LESS_THAN) ->filterByDbStarts($showsPopulatedUntil->format("Y-m-d H:i:s"), Criteria::LESS_THAN)
@ -175,7 +185,9 @@ class Application_Service_SchedulerService
/** /**
* *
* Enter description here ... * This function gets called after new linked show_instances are created.
* It fills the new show instances' schedules.
*
* @param CcShow_type $ccShow * @param CcShow_type $ccShow
* @param array $instanceIdsToFill ids of the new linked cc_show_instances that * @param array $instanceIdsToFill ids of the new linked cc_show_instances that
* were created and now need their schedules filled * were created and now need their schedules filled
@ -229,13 +241,10 @@ class Application_Service_SchedulerService
//need to find out which linked instances are empty //need to find out which linked instances are empty
$values = array(); $values = array();
//pass in new criteria object so propel doesn't return cached results
//$futureInstanceIds = $ccShow->getFutureInstanceIds(new Criteria());
$con = Propel::getConnection(); $con = Propel::getConnection();
try { try {
$con->beginTransaction(); $con->beginTransaction();
//foreach ($futureInstanceIds as $id)
foreach ($instanceIdsToFill as $id) foreach ($instanceIdsToFill as $id)
{ {
$instanceSched_sql = "SELECT * FROM cc_schedule ". $instanceSched_sql = "SELECT * FROM cc_schedule ".
@ -249,6 +258,7 @@ class Application_Service_SchedulerService
* the most recent instance, we need to fill/replace with the linked * the most recent instance, we need to fill/replace with the linked
* show schedule * show schedule
*/ */
//TODO can this check be removed?
if (count($showInstanceContents) < 1 || if (count($showInstanceContents) < 1 ||
self::replaceInstanceContentCheck($showInstanceContents, $linkedShowSchedule, $id)) self::replaceInstanceContentCheck($showInstanceContents, $linkedShowSchedule, $id))
{ {