models/classes/runner/QtiRunnerService.php
public function isItemCompleted(RunnerServiceContext $context, $routeItem, $itemSession, $partially = true) {
        if ($context instanceof QtiRunnerServiceContext && $context->isAdaptive()) {
            $itemIdentifier = $context->getCurrentAssessmentItemRef()->getIdentifier();
            $itemState = $this->getItemState($context, $itemIdentifier);
            if ($itemState !== null) {
                // as the item comes from a CAT section, it is simpler to load the responses from the state
                $itemResponse = [];
                foreach ($itemState as $key => $value) {
                    if (isset($value['response'])) {
                        $itemResponse[$key] = $value['response'];
                    }
                }
                $responses = $this->parsesItemResponse($context, $itemIdentifier, $itemResponse);

                // fork of AssessmentItemSession::isResponded()
                $excludedResponseVariables = array('numAttempts', 'duration');
                foreach ($responses as $var) {

                    if ($var instanceof ResponseVariable && in_array($var->getIdentifier(), $excludedResponseVariables) === false) {
                        $value = $var->getValue();
                        $defaultValue = $var->getDefaultValue();

                        if (Utils::isNull($value) === true) {
                            if (Utils::isNull($defaultValue) === (($partially) ? false : true)) {
                                return (($partially) ? true : false);
                            }
                        } else {
                            if ($value->equals($defaultValue) === (($partially) ? false : true)) {
                                return (($partially) ? true : false);
                            }
                        }
                    }
                }
            }

            return (($partially) ? false : true);
        } else {
            return TestRunnerUtils::isItemCompleted($routeItem, $itemSession, $partially);
        }
    }
public function isItemCompleted(RunnerServiceContext $context, $routeItem, $itemSession, $partially = true) {
        if ($context instanceof QtiRunnerServiceContext && $context->isAdaptive()) {
            $itemIdentifier = $context->getCurrentAssessmentItemRef()->getIdentifier();
            $itemState = $this->getItemState($context, $itemIdentifier);
            if ($itemState !== null) {
                // as the item comes from a CAT section, it is simpler to load the responses from the state
                $itemResponse = [];
                foreach ($itemState as $key => $value) {
                    if (isset($value['response'])) {
                        $itemResponse[$key] = $value['response'];
                    }
                }
                $responses = $this->parsesItemResponse($context, $itemIdentifier, $itemResponse);

                // fork of AssessmentItemSession::isResponded()
                $excludedResponseVariables = array('numAttempts', 'duration');
                foreach ($responses as $var) {

                    if ($var instanceof ResponseVariable && in_array($var->getIdentifier(), $excludedResponseVariables) === false) {
                        $value = $var->getValue();
                        $defaultValue = $var->getDefaultValue();

                        if (Utils::isNull($value) === true) {
                            if (Utils::isNull($defaultValue) === (($partially) ? false : true)) {
                                return (($partially) ? true : false);
                            }
                        } else {
                            if ($value->equals($defaultValue) === (($partially) ? false : true)) {
                                return (($partially) ? true : false);
                            }
                        }
                    }
                }
            }

            return (($partially) ? false : true);
        } else {
            return TestRunnerUtils::isItemCompleted($routeItem, $itemSession, $partially);
        }
    }
Checks if an item has been completed
@param RunnerServiceContext $context
@param RouteItem $routeItem
@param AssessmentItemSession $itemSession
@param bool $partially (optional) Whether or not consider partially responded sessions as responded.
@return bool
@throws \common_Exception