/**
  * Set the result Range
  * @param tx_caretaker_TestResultRange $testResultRange
  */
 public function setAggregatorResultrange(tx_caretaker_AggregatorResultRange $aggregatorResultRange)
 {
     $this->aggregatorResultRange = $aggregatorResultRange;
     $this->aggregatorResultRangeInfos = $this->aggregatorResultRange->getInfos();
     $this->setStartTimestamp($this->aggregatorResultRange->getStartTimestamp());
     $this->setEndTimestamp($this->aggregatorResultRange->getEndTimestamp());
     $maxValue = 0;
     foreach ($this->aggregatorResultRange as $aggregatorResult) {
         $undefined = $aggregatorResult->getNumUNDEFINED();
         $ok = $aggregatorResult->getNumOK();
         $warning = $aggregatorResult->getNumWARNING();
         $error = $aggregatorResult->getNumERROR();
         $count = $undefined + $ok + $warning + $error;
         if ($count > $maxValue) {
             $maxValue = $count;
         }
     }
     $this->setMinValue(0);
     $this->setMaxValue($maxValue);
     $this->init();
 }
 public function getResultRangeByNodeAndOffset($node, $offset = 0, $limit = 10)
 {
     $result_range = new tx_caretaker_AggregatorResultRange(NULL, NULL);
     $instance = $node->getInstance();
     if ($instance) {
         $instanceUid = $instance->getUid();
     } else {
         $instanceUid = 0;
     }
     $nodeType = $node->getType();
     $nodeUid = $node->getUid();
     $base_condition = 'aggregator_uid=' . $nodeUid . ' AND aggregator_type="' . $nodeType . '" AND instance_uid=' . $instanceUid;
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_caretaker_aggregatorresult', $base_condition, '', 'tstamp DESC', (int) $offset . ',' . (int) $limit);
     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $result = $this->dbrow2instance($row);
         $result_range->addResult($result);
     }
     return $result_range;
 }