-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #560 from oat-sa/release-5.8.2
Release 5.8.2
- Loading branch information
Showing
36 changed files
with
2,342 additions
and
792 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
/.settings/ | ||
/.buildpath | ||
composer.lock | ||
/vendor/ | ||
/vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,6 @@ | |
* @author Jean-Sébastien Conan <[email protected]> | ||
*/ | ||
|
||
use oat\taoQtiTest\models\runner\QtiRunnerRequiredException; | ||
use oat\taoQtiTest\models\runner\QtiRunnerService; | ||
use oat\taoQtiTest\models\runner\QtiRunnerServiceContext; | ||
use oat\taoQtiTest\models\runner\QtiRunnerClosedException; | ||
|
@@ -29,6 +28,7 @@ | |
use oat\taoQtiTest\models\event\TraceVariableStored; | ||
use \oat\taoTests\models\runner\CsrfToken; | ||
use \oat\taoQtiTest\models\runner\session\TestCsrfToken; | ||
use taoQtiTest_helpers_TestRunnerUtils as TestRunnerUtils; | ||
|
||
|
||
/** | ||
|
@@ -64,7 +64,7 @@ public function __construct() | |
$this->runnerService = $this->getServiceManager()->get(QtiRunnerService::CONFIG_ID); | ||
|
||
// Prevent anything to be cached by the client. | ||
taoQtiTest_helpers_TestRunnerUtils::noHttpClientCache(); | ||
TestRunnerUtils::noHttpClientCache(); | ||
} | ||
|
||
/** | ||
|
@@ -441,6 +441,7 @@ public function submitItem() | |
|
||
$state = isset($data['itemState']) ? $data['itemState'] : new stdClass(); | ||
$itemResponse = isset($data['itemResponse']) ? $data['itemResponse'] : []; | ||
$emptyAllowed = isset($data['emptyAllowed']) ? $data['emptyAllowed'] : false; | ||
|
||
try { | ||
$serviceContext = $this->getServiceContext(false); | ||
|
@@ -455,29 +456,40 @@ public function submitItem() | |
// do not allow to store the response if the session is in a wrong state | ||
$this->runnerService->check($serviceContext); | ||
|
||
$successResponse = $this->runnerService->storeItemResponse($serviceContext, $itemRef, $itemResponse); | ||
$displayFeedback = $this->runnerService->displayFeedbacks($serviceContext); | ||
$responses = $this->runnerService->parsesItemResponse($serviceContext, $itemRef, $itemResponse); | ||
|
||
$response = [ | ||
'success' => $successState && $successResponse, | ||
'displayFeedbacks' => $displayFeedback, | ||
]; | ||
|
||
if ($displayFeedback == true) { | ||
//FIXME there is here a performance issue, at the end we need the defitions only once, not at each storage | ||
$response['feedbacks'] = $this->runnerService->getFeedbacks($serviceContext, $itemRef); | ||
$response['itemSession'] = $this->runnerService->getItemSession($serviceContext); | ||
$allowed = true; | ||
$session = $serviceContext->getTestSession(); | ||
if (!$emptyAllowed && !TestRunnerUtils::doesAllowSkipping($session) && | ||
$this->runnerService->getTestConfig()->getConfigValue('enableAllowSkipping')) { | ||
$allowed = !$this->runnerService->emptyResponse($serviceContext, $responses); | ||
} | ||
|
||
if ($allowed) { | ||
$successResponse = $this->runnerService->storeItemResponse($serviceContext, $itemRef, $responses); | ||
$displayFeedback = $this->runnerService->displayFeedbacks($serviceContext); | ||
|
||
$this->runnerService->persist($serviceContext); | ||
$response = [ | ||
'success' => $successState && $successResponse, | ||
'displayFeedbacks' => $displayFeedback, | ||
]; | ||
|
||
} catch (QtiRunnerRequiredException $e) { | ||
// we need to restart timer | ||
$this->runnerService->startTimer($this->getServiceContext()); | ||
if ($displayFeedback == true) { | ||
//FIXME there is here a performance issue, at the end we need the defitions only once, not at each storage | ||
$response['feedbacks'] = $this->runnerService->getFeedbacks($serviceContext, $itemRef); | ||
$response['itemSession'] = $this->runnerService->getItemSession($serviceContext); | ||
} | ||
|
||
$this->runnerService->persist($serviceContext); | ||
} else { | ||
$this->runnerService->startTimer($serviceContext); | ||
$response = [ | ||
'success' => true, | ||
'notAllowed' => true, | ||
'message' => __('You must answer the question before leaving this item!'), | ||
]; | ||
} | ||
|
||
$response = $this->getErrorResponse($e); | ||
$code = $this->getErrorCode($e); | ||
|
||
} catch (common_Exception $e) { | ||
$response = $this->getErrorResponse($e); | ||
$code = $this->getErrorCode($e); | ||
|
@@ -499,6 +511,7 @@ public function move() | |
|
||
try { | ||
$serviceContext = $this->getServiceContext(); | ||
$serviceContext->getTestSession()->initItemTimer(); | ||
$result = $this->runnerService->move($serviceContext, $direction, $scope, $ref); | ||
|
||
$response = [ | ||
|
@@ -709,7 +722,7 @@ public function flagItem() | |
$flag = true; | ||
} | ||
|
||
taoQtiTest_helpers_TestRunnerUtils::setItemFlag($testSession, $itemPosition, $flag); | ||
TestRunnerUtils::setItemFlag($testSession, $itemPosition, $flag); | ||
|
||
$response = [ | ||
'success' => true, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Empty file.
Oops, something went wrong.