private function updateExtraTime()
    {
        $testSession = $this->getTestSession();
        if ($testSession instanceof TestSession) {
            $timer = $testSession->getTimer();
            $timerTarget = $testSession->getTimerTarget();
        } else {
            $timerTarget = TimePoint::TARGET_SERVER;
            $qtiTimerFactory = $this->getServiceLocator()->get(QtiTimerFactory::SERVICE_ID);
            $timer = $qtiTimerFactory->getTimer($this->deliveryExecution->getIdentifier(), $this->deliveryExecution->getUserIdentifier());
        }

        $deliveryExecutionManager = $this->getServiceLocator()->get(DeliveryExecutionManagerService::SERVICE_ID);
        $maxTimeSeconds = $deliveryExecutionManager->getTimeLimits($testSession);

        $data = $this->get();
        $oldConsumedExtraTime = isset($data[DeliveryMonitoringService::CONSUMED_EXTRA_TIME]) ? $data[DeliveryMonitoringService::CONSUMED_EXTRA_TIME] : 0;
        $consumedExtraTime = max($oldConsumedExtraTime, $timer->getConsumedExtraTime(null, $maxTimeSeconds, $timerTarget));

        $this->addValue(DeliveryMonitoringService::EXTRA_TIME, $timer->getExtraTime($maxTimeSeconds), true);
        $this->addValue(DeliveryMonitoringService::CONSUMED_EXTRA_TIME, $consumedExtraTime, true);
    }
private function updateExtraTime()
    {
        $testSession = $this->getTestSession();
        if ($testSession instanceof TestSession) {
            $timer = $testSession->getTimer();
            $timerTarget = $testSession->getTimerTarget();
        } else {
            $timerTarget = TimePoint::TARGET_SERVER;
            $qtiTimerFactory = $this->getServiceLocator()->get(QtiTimerFactory::SERVICE_ID);
            $timer = $qtiTimerFactory->getTimer($this->deliveryExecution->getIdentifier(), $this->deliveryExecution->getUserIdentifier());
        }

        $deliveryExecutionManager = $this->getServiceLocator()->get(DeliveryExecutionManagerService::SERVICE_ID);
        $maxTimeSeconds = $deliveryExecutionManager->getTimeLimits($testSession);

        $data = $this->get();
        $oldConsumedExtraTime = isset($data[DeliveryMonitoringService::CONSUMED_EXTRA_TIME]) ? $data[DeliveryMonitoringService::CONSUMED_EXTRA_TIME] : 0;
        $consumedExtraTime = max($oldConsumedExtraTime, $timer->getConsumedExtraTime(null, $maxTimeSeconds, $timerTarget));

        $this->addValue(DeliveryMonitoringService::EXTRA_TIME, $timer->getExtraTime($maxTimeSeconds), true);
        $this->addValue(DeliveryMonitoringService::CONSUMED_EXTRA_TIME, $consumedExtraTime, true);
    }
private function updateExtraTime ( ) { $ testSession = $ this -> getTestSession ( ) ; if ( $ testSession instanceof TestSession ) { $ timer = $ testSession -> getTimer ( ) ; $ timerTarget = $ testSession -> getTimerTarget ( ) ; } else { $ timerTarget = TimePoint :: TARGET_SERVER ; $ qtiTimerFactory = $ this -> getServiceLocator ( ) -> get ( QtiTimerFactory :: SERVICE_ID ) ; $ timer = $ qtiTimerFactory -> getTimer ( $ this -> deliveryExecution -> getIdentifier ( ) , $ this -> deliveryExecution -> getUserIdentifier ( ) ) ; } $ deliveryExecutionManager = $ this -> getServiceLocator ( ) -> get ( DeliveryExecutionManagerService :: SERVICE_ID ) ; $ maxTimeSeconds = $ deliveryExecutionManager -> getTimeLimits ( $ testSession ) ; $ data = $ this -> get ( ) ; $ oldConsumedExtraTime = isset ( $ data [ DeliveryMonitoringService :: CONSUMED_EXTRA_TIME ] ) ? $ data [ DeliveryMonitoringService :: CONSUMED_EXTRA_TIME ] : 0 ; $ consumedExtraTime = max ( $ oldConsumedExtraTime , $ timer -> getConsumedExtraTime ( null , $ maxTimeSeconds , $ timerTarget ) ) ; $ this -> addValue ( DeliveryMonitoringService :: EXTRA_TIME , $ timer -> getExtraTime ( $ maxTimeSeconds ) , true ) ; $ this -> addValue ( DeliveryMonitoringService :: CONSUMED_EXTRA_TIME , $ consumedExtraTime , true ) ; }
Update extra time allowed for the delivery execution
Update extra time allowed for the delivery execution