public function completedAssessmentsData()
    {
        $timePeriod = $this->getRequestParameter('interval');

        $eventLog = $this->getServiceLocator()->get(\oat\taoEventLog\model\eventLog\LoggerService::SERVICE_ID);

        $tz = new \DateTimeZone(\common_session_SessionManager::getSession()->getTimeZone());
        $timeKeys = $this->getTimeKeys($timePeriod);
        $interval = $this->getInterval($timePeriod);

        foreach ($timeKeys as $timeKey) {
            $to = clone($timeKey);
            $from = clone($to);
            $from->sub($interval);
            $countEvents = $eventLog->count([
                ['occurred', 'between', $from->format('Y-m-d H:i:s'), $to->format('Y-m-d H:i:s')],
                ['event_name', '=', DeliveryExecutionFinished::class],
            ]);
            $result['time'][] = $to->setTimezone($tz)->format('Y-m-d H:i:s');
            $result['amount'][] = $countEvents;
        }

        $this->returnJson($result, 200);
    }
public function completedAssessmentsData()
    {
        $timePeriod = $this->getRequestParameter('interval');

        $eventLog = $this->getServiceLocator()->get(\oat\taoEventLog\model\eventLog\LoggerService::SERVICE_ID);

        $tz = new \DateTimeZone(\common_session_SessionManager::getSession()->getTimeZone());
        $timeKeys = $this->getTimeKeys($timePeriod);
        $interval = $this->getInterval($timePeriod);

        foreach ($timeKeys as $timeKey) {
            $to = clone($timeKey);
            $from = clone($to);
            $from->sub($interval);
            $countEvents = $eventLog->count([
                ['occurred', 'between', $from->format('Y-m-d H:i:s'), $to->format('Y-m-d H:i:s')],
                ['event_name', '=', DeliveryExecutionFinished::class],
            ]);
            $result['time'][] = $to->setTimezone($tz)->format('Y-m-d H:i:s');
            $result['amount'][] = $countEvents;
        }

        $this->returnJson($result, 200);
    }
public function completedAssessmentsData ( ) { $ timePeriod = $ this -> getRequestParameter ( 'interval' ) ; $ eventLog = $ this -> getServiceLocator ( ) -> get ( \ oat \ taoEventLog \ model \ eventLog \ LoggerService :: SERVICE_ID ) ; $ tz = new \ DateTimeZone ( \ common_session_SessionManager :: getSession ( ) -> getTimeZone ( ) ) ; $ timeKeys = $ this -> getTimeKeys ( $ timePeriod ) ; $ interval = $ this -> getInterval ( $ timePeriod ) ; foreach ( $ timeKeys as $ timeKey ) { $ to = clone ( $ timeKey ) ; $ from = clone ( $ to ) ; $ from -> sub ( $ interval ) ; $ countEvents = $ eventLog -> count ( [ [ 'occurred' , 'between' , $ from -> format ( 'Y-m-d H:i:s' ) , $ to -> format ( 'Y-m-d H:i:s' ) ] , [ 'event_name' , '=' , DeliveryExecutionFinished :: class ] , ] ) ; $ result [ 'time' ] [ ] = $ to -> setTimezone ( $ tz ) -> format ( 'Y-m-d H:i:s' ) ; $ result [ 'amount' ] [ ] = $ countEvents ; } $ this -> returnJson ( $ result , 200 ) ; }
Get completed assessments data
Get completed assessments data