Forum

Get all results of a test taker

Hi,
What is the best way to get all results of all deliveries of specific test taker?
Thanks.

Comments

  • DevDev
    edited June 2018

    Hi,
    I have found a way to get them, hope this helps others have same scenario

    $data = array();
                $deliveryService = DeliveryAssemblyService::singleton();
                foreach ($deliveryService->getAllAssemblies() as $assembly) {
                    $this->getResultStorage($assembly);
                    // consider all deliveries have same sotrage
                    break;
                }
                // get all test takers IDs, this returns 
                $results = $this->getClassService()->getImplementation()->getAllTestTakerIds();
                // loop over test taker IDs and get results of candidate test taker
                foreach ($results as $res) {
                    if($testTakerId == $res['testTakerIdentifier'])
                    {
                        $deliveryExecution = ServiceProxy::singleton()->getDeliveryExecution($res['deliveryResultIdentifier']);
                        try {
                            $startTime = \tao_helpers_Date::displayeDate($deliveryExecution->getStartTime());
                        } catch (\common_exception_NotFound $e) {
                            \common_Logger::w($e->getMessage());
                            $startTime = '';
                        }
                    $data[] = array(
                            'id' => $deliveryExecution->getIdentifier(),
                            'deliveryId' =>  $deliveryExecution->getDelivery()->getUri(),
                            'deliveryCurrentTitle' => $deliveryExecution->getDelivery()->getLabel(),
                            'deliveryTitle' => $deliveryExecution->getLabel(),// This is embedded label in delivery execution
                            'deliveryTitle2' => $this->getDeliveryCustomLabel($deliveryExecution->getDelivery()),//this is current label (in case it was changed after execution)
                            'time' => $startTime,
                        );
                }
Sign In or Register to comment.

We use cookies on our website to support technical features that enhance your user experience. Cookie Policy Privacy Policy

×