Skip to content

Commit

Permalink
Merge branch 'develop' into l10n_develop
Browse files Browse the repository at this point in the history
  • Loading branch information
augustas committed Apr 10, 2024
2 parents b539e92 + c2cffd0 commit 3496f9d
Show file tree
Hide file tree
Showing 212 changed files with 3,885 additions and 6,761 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/release_tao_extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,18 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ secrets.SEMVER_GH_TOKEN }} #bypass branch protection rule

- name: Configure git user
#configuring git for runner
run: |
git config --global user.name "oat-github-bot"
git config --global user.email "[email protected]"
- name: Release
uses: oat-sa/extension-release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.SEMVER_GH_TOKEN }}
with:
github_token: ${{ secrets.GH_TOKEN }}
github_token: ${{ secrets.SEMVER_GH_TOKEN }}
41 changes: 41 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Sonarqube_CI
on:

push:
branches:
- master
- main
- develop

pull_request:
types: [opened, synchronize, reopened]
branches:
- '**'
workflow_dispatch:

jobs:
build:
name: Sonarqube_CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Sonarqube scan
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

# Job will fail when the Quality Gate is red
- name: Sonarqube quality gate check
id: sonarqube-quality-gate-check
uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}


- name: "Example show SonarQube Quality Gate Status value"
run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ Environment variables
| Var | Description |
|-----------------------------------------------|-------------------------------------------------------------------------------------|
| FEATURE_FLAG_FORCE_DISPLAY_TEST_ITEM_FEEDBACK | Even if itemSessionControl `showFeedback` option is false, show item feedback modal |
| FEATURE_FLAG_PAUSE_CONCURRENT_SESSIONS | When set, forces restoring the timers state from the browser storage on test init |
55 changes: 42 additions & 13 deletions actions/class.Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2016-2020 (original work) Open Assessment Technologies SA ;
* Copyright (c) 2016-2023 (original work) Open Assessment Technologies SA.
*/

/**
Expand All @@ -25,10 +25,10 @@
*/

use oat\libCat\exception\CatEngineConnectivityException;
use oat\tao\model\routing\AnnotationReader\security;
use oat\taoDelivery\model\execution\DeliveryExecutionInterface;
use oat\taoDelivery\model\execution\DeliveryExecutionService;
use oat\taoDelivery\model\RuntimeService;
use oat\taoQtiTest\model\Service\ConcurringSessionService;
use oat\taoQtiTest\model\Service\ExitTestCommand;
use oat\taoQtiTest\model\Service\ExitTestService;
use oat\taoQtiTest\model\Service\ItemContextAwareInterface;
Expand Down Expand Up @@ -59,6 +59,7 @@
use oat\taoQtiTest\models\runner\QtiRunnerServiceContext;
use oat\taoQtiTest\models\runner\RunnerToolStates;
use oat\taoQtiTest\models\runner\StorageManager;
use qtism\runtime\tests\AssessmentTestSessionState;
use taoQtiTest_helpers_TestRunnerUtils as TestRunnerUtils;
use oat\oatbox\session\SessionService;

Expand Down Expand Up @@ -143,7 +144,7 @@ protected function getSessionId()
/**
* Gets the test service context
* @return QtiRunnerServiceContext
* @throws \common_Exception
* @throws common_Exception
*/
protected function getServiceContext()
{
Expand All @@ -168,6 +169,7 @@ protected function getServiceContext()
}
$testDefinition = $container->getSourceTest($execution);
$testCompilation = $container->getPrivateDirId($execution) . '|' . $container->getPublicDirId($execution);

$this->serviceContext = $this->getRunnerService()->getServiceContext(
$testDefinition,
$testCompilation,
Expand Down Expand Up @@ -295,7 +297,6 @@ public function init()
$this->validateSecurityToken();

try {
/** @var QtiRunnerServiceContext $serviceContext */
$serviceContext = $this->getRunnerService()->initServiceContext($this->getServiceContext());
$this->returnJson($this->getInitResponse($serviceContext));
} catch (Exception $e) {
Expand Down Expand Up @@ -492,7 +493,7 @@ protected function getItemData($itemIdentifier)
* Save the actual item state.
* Requires params itemIdentifier and itemState
* @return boolean true if saved
* @throws \common_Exception
* @throws common_Exception
*/
protected function saveItemState()
{
Expand All @@ -509,7 +510,7 @@ protected function saveItemState()
* End the item timer and save the duration
* Requires params itemDuration and optionaly consumedExtraTime
* @return boolean true if saved
* @throws \common_Exception
* @throws common_Exception
*/
protected function endItemTimer()
{
Expand All @@ -526,7 +527,7 @@ protected function endItemTimer()
* Requires params itemDuration and optionally consumedExtraTime
* @param boolean $emptyAllowed if we allow empty responses
* @return boolean true if saved
* @throws \common_Exception
* @throws common_Exception
* @throws QtiRunnerEmptyResponsesException if responses are empty, emptyAllowed is false and no allowSkipping
*/
protected function saveItemResponses($emptyAllowed = true)
Expand Down Expand Up @@ -618,6 +619,9 @@ public function submitItem()

/**
* Moves the current position to the provided scoped reference: item, section, part
*
* This action is called when the user sends a test response, but not when
* the test starts.
*/
public function move()
{
Expand All @@ -638,10 +642,10 @@ public function move()

$response = $moveService($moveCommand);

common_Logger::d('Test session state : ' . $this->getServiceContext()->getTestSession()->getState());

$this->returnJson($response->toArray());
} catch (common_Exception $e) {
$this->checkExceptionForTestSessionConflict($e);

$this->returnJson(
$this->getErrorResponse($e),
$this->getStatusCodeFromException($e)
Expand Down Expand Up @@ -673,6 +677,8 @@ public function skip()

$this->returnJson($response->toArray());
} catch (common_Exception $e) {
$this->checkExceptionForTestSessionConflict($e);

$this->returnJson(
$this->getErrorResponse($e),
$this->getStatusCodeFromException($e)
Expand Down Expand Up @@ -706,6 +712,8 @@ public function timeout()

$this->returnJson($response->toArray());
} catch (common_Exception $e) {
$this->checkExceptionForTestSessionConflict($e);

$this->returnJson(
$this->getErrorResponse($e),
$this->getStatusCodeFromException($e)
Expand Down Expand Up @@ -771,10 +779,7 @@ public function pause()

$this->setItemContextToCommand($command);

/** @var PauseService $pause */
$pause = $this->getPsrContainer()->get(PauseService::class);

$response = $pause($command);
$response = $this->getPauseService()($command);

$this->returnJson($response->toArray());
} catch (common_Exception $e) {
Expand Down Expand Up @@ -1102,6 +1107,11 @@ private function getRuntimeService(): RuntimeService
return $this->getServiceLocator()->get(RuntimeService::SERVICE_ID);
}

private function getPauseService(): PauseService
{
return $this->getPsrContainer()->get(PauseService::class);
}

private function getItemDuration(): ?float
{
if (!$this->hasRequestParameter('itemDuration')) {
Expand Down Expand Up @@ -1168,4 +1178,23 @@ private function createErrorResponseFromException(Exception $exception): void
$this->getStatusCodeFromException($exception)
);
}

private function checkExceptionForTestSessionConflict($exception): void
{
if (!$exception instanceof common_exception_Unauthorized) {
return;
}

try {
if ($this->getServiceContext()->getTestSession()->getState() === AssessmentTestSessionState::INTERACTING) {
$this->getConcurringSessionService()->setConcurringSession($this->getSessionId());
}
} catch (common_Exception $exception) {
}
}

private function getConcurringSessionService(): ConcurringSessionService
{
return $this->getPsrContainer()->get(ConcurringSessionService::class);
}
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
"oat-sa/oatbox-extension-installer": "~1.1||dev-master",
"qtism/qtism": ">=0.28.3",
"oat-sa/generis" : ">=15.22",
"oat-sa/tao-core": ">=53.0.0",
"oat-sa/extension-tao-item" : ">=12.0.0",
"oat-sa/tao-core": ">=54.0.0",
"oat-sa/extension-tao-item" : ">=12.1.0",
"oat-sa/extension-tao-itemqti" : ">=30.0.0",
"oat-sa/extension-tao-test" : ">=16.0.0",
"oat-sa/extension-tao-delivery" : ">=15.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

/**
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand All @@ -13,12 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2019 (original work) Open Assessment Technologies SA ;
* Copyright (c) 2023 (original work) Open Assessment Technologies SA;
*/

/**
* Urls for the test runner
*/
export default {
availableDeliveriesPageUrl: '/taoDelivery/DeliveryServer/index'
};
return new oat\taoQtiTest\models\DeliveryItemTypeService();
2 changes: 1 addition & 1 deletion crowdin.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
files:
- source: /locales/en-US/*.po
- source: /locales/en-US/messages.po
translation: /locales/%locale%/%original_file_name%
18 changes: 18 additions & 0 deletions helpers/class.TestSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
use qtism\data\processing\OutcomeProcessing;
use qtism\data\rules\OutcomeRuleCollection;
use qtism\data\rules\SetOutcomeValue;
use qtism\data\state\OutcomeDeclaration;
use qtism\runtime\common\OutcomeVariable;
use qtism\runtime\common\ProcessingException;
use qtism\runtime\processing\OutcomeProcessingEngine;
Expand Down Expand Up @@ -822,6 +823,23 @@ private function triggerResultTestVariablesTransmissionEvent(
));
}

public function isManualScored(): bool
{
/** @var AssessmentItemRef $itemRef */
foreach ($this->getRoute()->getAssessmentItemRefs() as $itemRef) {
foreach ($itemRef->getComponents() as $component) {
if (
$component instanceof OutcomeDeclaration
&& $component->isExternallyScored()
) {
return true;
}
}
}

return false;
}

/**
* @param TestSessionMemento $sessionMemento
*/
Expand Down
Loading

0 comments on commit 3496f9d

Please sign in to comment.