The round description of the first round that has not been answered.

@return string Round description or Stopped/Completed if not found.
483713
public function getCurrentRound()
    {
        $isStop = false;
        $today  = new \Zend_Date();
        $tokens = $this->getTokens();
        $stop   = $this->util->getReceptionCodeLibrary()->getStopString();

        foreach ($tokens as $token) {
            $validUntil = $token->getValidUntil();

            if (! empty($validUntil) && $validUntil->isEarlier($today)) {
                continue;
            }

            if ($token->isCompleted()) {
                continue;
            }

            $code = $token->getReceptionCode();
            if (! $code->isSuccess()) {
                if ($code->getCode() === $stop) {
                    $isStop = true;
                }
                continue;
            }

            return $token->getRoundDescription();
        }
        if ($isStop) {
            return $this->translate->_('Track stopped');
        }

        return $this->translate->_('Track completed');
    }
306413
public function getRound( $precision = 0, $mode = PHP_ROUND_HALF_UP )
	{
		if ( $this->getIsDecimal() === false )
		{
			// return $this;
		}

		if ( $precision === false ) $precision = $this->scale( $this->_value );
		if ( is_null( $precision ) ) $precision = 0;
		// if( $precision < 0) $precision = 0;

		$factor = 1;

		// If the precision is negative create a factor
		if ( $precision < 0 )
		{
			$precision = abs( $precision );
			$factor = bcpow( 10, $precision, $precision );
			$precision = 0;
		}

		// Create a new decimal on which to perform rounding
		$rounder = $this->Div( $factor );

		$isHalf = false;
		$increment = "0";
		$number = $rounder->_value;
		$sign = "";

		if ( $mode == PHP_ROUND_HALF_EVEN || $mode == PHP_ROUND_HALF_ODD )
		{
			// These are only relevant if the precision rounds the least significant digit and that digit is 5.
			if ( $rounder->getDecimalIsHalf( $precision ) )
			{
				$isHalf = true;

				if ( $precision - 1 >= 0 )
				// if ( $this->getIntegerPart() != 0 )
				{
					if ( $rounder->getIsDecimalEven( $precision - 1) )
					{
						if ( $mode == PHP_ROUND_HALF_ODD )
						{
							$sign = $rounder->getIsNegative() ? "-" : "";
							// The amount to add or substract is 1 at the digit position one above the $scale position
							// If the scale is zero then the value change is 1 or -1.  If the scale is 1 then the
							// change is 0.1 or -0.1.
							$increment = $sign . bcpow( 10, "-$precision", $precision );
						}
					}
					else
					{
						if ( $mode == PHP_ROUND_HALF_EVEN )
						{
							$sign = $rounder->getIsNegative() ? "-" : "";
							// The amount to add or substract is 1 at the digit position one above the $scale position
							// If the scale is zero then the value change is 1 or -1.  If the scale is 1 then the
							// change is 0.1 or -0.1.
							$increment = $sign . bcpow( 10, "-$precision", $precision );

						}
					}
				}
				else
				{
					if ( $rounder->getIsIntegerEven( $precision ) )
					{
						if ( $mode == PHP_ROUND_HALF_ODD )
						{
							$sign = $rounder->getIsNegative() ? -1 : 1;
							$increment = 1 * $sign;
						}
					}
					else
					{
						if ( $mode == PHP_ROUND_HALF_EVEN )
						{
							$sign = $rounder->getIsNegative() ? -1 : 1;
							$increment = 1 * $sign;
						}
					}
				}

			}
		}

		if ( $rounder->getIsNegative() && $mode == PHP_ROUND_HALF_UP )
		{
			$mode = PHP_ROUND_HALF_DOWN;
		// 	$mode = $mode == PHP_ROUND_HALF_UP
		// 		? PHP_ROUND_HALF_DOWN
		// 		: PHP_ROUND_HALF_UP;
		}

		// Round half-up or half-down according to the $mode
		if ( ! $isHalf && $rounder->getIsCloserToNext( $precision, $mode ) )
		{
			$decimalPart = $rounder->getDecimalPart();
			if ( strlen( $decimalPart > $precision ) )
			{
				$sign = $rounder->getIsNegative() ? "-" : "";
				// The amount to add or substract is 1 at the digit position one above the $scale position
				// If the scale is zero then the value change is 1 or -1.  If the scale is 1 then the
				// change is 0.1 or -0.1.
				$increment = $sign . bcpow( 10, "-$precision", $precision );
			}
		}

		$rounder = DecimalValue::FromValue( bcadd( $rounder->getValue(), $increment, $precision ) );
		if ( $factor > 1 )
		{
			$rounder = $rounder->Mul( $factor );
		}

		return $rounder;
		// return new DecimalValue( $number );
	}
1180565
public function getRoundDefaults()
    {
        $defaults = parent::getRoundDefaults();

        // Now check if the valid for depends on the same round
        if (count($defaults) > 1) {
            $lastRound = end($this->_rounds);   // We need the ID to compare
            if ($defaults['gro_valid_for_source']     == 'tok' &&
                    $defaults['gro_valid_for_field']  == 'gto_valid_from' &&
                    $defaults['gro_valid_for_id']     == $lastRound['gro_id_round']) {
                $defaults['gro_valid_for_id'] = 0;  // Will be updated on save
            }
        } else {
            $defaults['gro_valid_after_source'] = 'rtr';
        }

        return $defaults;
    }
247539
public function tail()
    {
        $last = count($this->parts) - 1;
        if ($last < 0) {
            return null;
        }

        return $this->parts[$last];
    }
398853
public function remaining()
	{
		if ( ! file_exists($this->path))
		{
			// this is the first hit
			return $this->hits;
		}
		$hits = $this->getPathContent('hits');

		return $this->hits - $hits;
	}
696106
public function getDescription()
    {
        if ($this->max !== -1) {
            return vsprintf(
                'The value is expected to have a length between %d and %d'
                . ' (%d <= x <= %d).',
                [
                    $this->min,
                    $this->max,
                    $this->min,
                    $this->max,
                ]
            );
        }

        return vsprintf(
            'The value is expected to have a length greater or equal to %d'
            . ' (%d <= x).',
            [
                $this->min,
                $this->min,
            ]
        );
    }
504824
public function addRound()
	{
		++$this->_currentRoundNo;

		$new_round = $this->_newRound();

		$this->_rounds->offsetSet($this->_currentRoundNo, $new_round);

		return $new_round;
	}
629157
public function getTransactionString()
    {
        return sprintf(
                "Paymentmethod: %s \n| OrderID: %s \n| Status: %s \n| StatusCode: %s \n| PaymentID: %s \n| TransactionID: %s \n| Amount: %s", isset($this->data->paymentMethod) ? $this->data->paymentMethod : "", isset($this->data->orderID) ? $this->data->orderID : "", isset($this->data->status) ? $this->data->status : "", isset($this->data->statusCode) ? $this->data->statusCode : "", isset($this->data->paymentID) ? $this->data->paymentID : "", isset($this->data->transactionID) ? $this->data->transactionID : "", isset($this->data->amount) ? $this->data->amount : ""
        );
    }
557308
protected function get_trace() {
        if (null === $this->trace) {
            $this->trace = new \text_progress_trace();
            $this->tracestats = new \stdClass();
        }

        return $this->trace;
    }
956895
public function getNextUnansweredToken()
    {
        $tokenSelect = $this->tracker->getTokenSelect();
        $tokenSelect
                ->andReceptionCodes()
                // ->andRespondents()
                // ->andRespondentOrganizations()
                // ->andConsents
                ->andRounds(array())
                ->andSurveys(array())
                ->forRespondent($this->getRespondentId())
                ->forGroupId($this->getSurvey()->getGroupId())
                ->onlySucces()
                ->onlyValid()
                ->forWhere('gsu_active = 1')
                ->forWhere('gro_active = 1 OR gro_active IS NULL')
                ->order(array('gto_valid_from', 'gto_round_order'));

        $this->_addRelation($tokenSelect);

        if ($tokenData = $tokenSelect->fetchRow()) {
            return $this->tracker->getToken($tokenData);
        }
    }
100224
private function getLastAnsweredQuestion()
    {
        $configuration = $this->getUserConfiguration();
        $answer = $configuration->getAnswers()->toArray();
        end($answer);
        key($answer);

        if (empty($answer)) {
            $answer = $this->getCurrentQuestion();
        }

        $this->getSpecificQuestion($answer);
    }
1052034
public function getSwapPercentUsed()
    {
        if ($this->getSwapTotal() !== null) {
            if ($this->getSwapTotal() > 0) {
                return round($this->getSwapUsed() / $this->getSwapTotal() * 100);
            } else {
                return 0;
            }
        } else {
            return null;
        }
    }
973660
public function getRoundCode($roundId)
    {
        $this->_ensureRounds();
        $roundCode = null;

        if (array_key_exists($roundId, $this->_rounds) && array_key_exists('gro_code', $this->_rounds[$roundId])) {
            $roundCode = $this->_rounds[$roundId]['gro_code'];
        }

        return $roundCode;
    }
927082
private static function roundToNearestIntegerIgnoringTies($amount)
    {
        $relevantDigit = substr(self::roundTowardsZero(bcmul($amount, '10', self::BCSCALE)), -1);

        $result = null;

        switch ($relevantDigit) {
            case '0':
            case '1':
            case '2':
            case '3':
            case '4':
                $result = self::roundTowardsZero($amount);
                break;
            case '5':
                $result = null; // handled by tie-breaking rules
                break;
            case '6':
            case '7':
            case '8':
            case '9':
                $result = self::roundAwayFromZero($amount);
                break;
        }

        return $result;
    }
673778
public function firstFormated(): string
    {
        if ($this->isEmpty()) {
            return '';
        }

        $crumb = reset($this->breadcrumbs);

        return $this->renderCrumb($crumb['name'], $crumb['href'], false, 1);
    }
274374
protected function getTokenTitle()
    {
        $token      = $this->getToken();
        $respondent = $token->getRespondent();

        // Set params
        return sprintf(
                $this->_('Token %s in round "%s" in track "%s" for respondent nr %s: %s'),
                $token->getTokenId(),
                $token->getRoundDescription(),
                $token->getTrackName(),
                $respondent->getPatientNumber(),
                $respondent->getName()
                );
    }
119760
public function description(): string
    {
        if (0 === $this->offset) {
            return 'limited to ' . $this->count . ' elements';
        }

        if (-1 === $this->count) {
            return 'skipped until offset ' . $this->offset;
        }

        return 'limited to ' . $this->count
         . ' elements starting from offset ' . $this->offset;
    }