/**
  * {@inheritdoc}
  */
 public function render(Varien_Object $row)
 {
     $executed = $row->getExecutedWithItems();
     if ($executed) {
         return $executed;
     }
     $executed = SixBySix_RealTimeDespatch_Model_Resource_Process_Schedule_Collection::getLastScheduleWithItems($row->getEntity())->getExecutedWithItems();
     if ($executed) {
         return $executed;
     }
     return 'Pending';
 }
 /**
  * {@inheritdoc}
  */
 public function render(Varien_Object $row)
 {
     $id = $row->getMessageId();
     $executed = $row->getExecuted();
     if (!$id && $executed) {
         return __('Pending');
     }
     if (!$id & $row->getType() == 'import') {
         $id = SixBySix_RealTimeDespatch_Model_Resource_Request_Line_Collection::getNextSequencesId($row->getEntity());
     }
     if (!$id) {
         $id = __('Pending');
     }
     return $id;
 }
 /**
  * Delete index for the specified entities
  *
  * @param Varien_Object $event
  * @return Algolia_Algoliasearch_Model_Observer
  */
 public function cleanIndex(Varien_Object $event)
 {
     $storeId = $event->getStoreId();
     $entityId = $event->getEntityId();
     $entity = $event->getEntity();
     if (is_null($storeId) && is_null($entityId)) {
         foreach (Mage::app()->getStores() as $store) {
             /** @var $store Mage_Core_Model_Store */
             if (!$store->getIsActive()) {
                 continue;
             }
             $this->deleteStoreIndex($store->getId());
         }
     } elseif (is_numeric($storeId) && is_null($entityId)) {
         $this->deleteStoreIndex($storeId);
     } elseif (!empty($entityId)) {
         $entityIds = (array) $entityId;
         if (is_numeric($storeId)) {
             $objectIds = array();
             foreach ($entityIds as $id) {
                 $objectIds[] = $entity . '_' . $id;
             }
             $this->getHelper()->getStoreIndex($storeId)->deleteObjects($objectIds);
         } elseif (is_null($storeId)) {
             foreach (Mage::app()->getStores() as $store) {
                 /** @var $store Mage_Core_Model_Store */
                 if (!$store->getIsActive()) {
                     continue;
                 }
                 $objectIds = array();
                 foreach ($entityIds as $id) {
                     $objectIds[] = $entity . '_' . $id;
                 }
                 $this->getHelper()->getStoreIndex($store->getId())->deleteObjects($objectIds);
             }
         }
     }
     Mage::getSingleton('algoliasearch/algolia')->resetSearchResults();
     return $this;
 }