Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration/rfe 1247 m3/solar design feature hiding #2482

Merged
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fa1fc97
feat: hide identifier test/testPart/section/itemRef
shaveko Jun 3, 2024
456afe0
feat: hide lateSubmission
shaveko Jun 3, 2024
c5e66d2
feat: hide custom outcome declaration
shaveko Jun 3, 2024
86597fa
feat: hide outcomeDeclarations
shaveko Jun 3, 2024
f74fecf
feat: hide item session control testPart
shaveko Jun 3, 2024
27bab58
feat: hide showFeedback section
shaveko Jun 3, 2024
6695363
feat: hide visible and keepTogether
shaveko Jun 3, 2024
c77231a
feat: hide rubric block class
shaveko Jun 7, 2024
11c68de
chore: Add interface mode in XML check
Nevermind23 Jun 10, 2024
e25cd26
chore: Lock xml edit during simple mode
Nevermind23 Jun 10, 2024
42861b7
chore: Point tao-core to the dev branch
Nevermind23 Jun 11, 2024
9cee04c
chore: Update tests
Nevermind23 Jun 11, 2024
6b4002c
Merge branch 'feat/AUT-3625/content-creation-mode-switch' into feat/A…
shaveko Jun 11, 2024
d8d342f
chore: Apply suggestions from code review
Nevermind23 Jun 12, 2024
e969f3e
chore: Apply suggestions from PR review
Nevermind23 Jun 12, 2024
205e3b5
chore: Change generis version
Nevermind23 Jun 12, 2024
c51c56d
chore: Add return type
Nevermind23 Jun 12, 2024
64112c0
chore: add bundles
shaveko Jun 12, 2024
94cf6d3
chore: Point to integration branch
Nevermind23 Jun 13, 2024
4f7fa21
Merge pull request #2475 from oat-sa/feat/AUT-3623/hide-features-in-s…
shaveko Jun 13, 2024
0b62cc4
Merge pull request #2481 from oat-sa/feat/AUT-3625/content-creation-m…
Nevermind23 Jun 13, 2024
01059b9
chore: Replace concrete classes with the interfaces
Nevermind23 Jun 14, 2024
54a3026
fix: lateSubmission tets prop
shaveko Jun 20, 2024
616b977
Merge remote-tracking branch 'origin/integration/RFE-1247-M3/solar-de…
shaveko Jun 20, 2024
3e10e73
fix: section lateSubmission allowance
shaveko Jun 20, 2024
575d19c
fix: submission selector visibility
shaveko Jun 20, 2024
98c5fcb
fix: weight and validateResponses visibility
shaveko Jun 20, 2024
6d7df0d
chore: add bundles
shaveko Jun 20, 2024
346bfa2
chore: Update composer
Nevermind23 Jun 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
"oat-sa/lib-test-cat": "2.3.7",
"oat-sa/oatbox-extension-installer": "~1.1||dev-master",
"qtism/qtism": ">=0.28.3",
"oat-sa/generis" : ">=15.22",
"oat-sa/tao-core": ">=54.14.0",
"oat-sa/generis" : "dev-feat/AUT-3625/content-creation-mode-switch",
"oat-sa/tao-core": "dev-integration/RFE-1247-M3/solar-design-feature-hiding",
"oat-sa/extension-tao-item" : ">=12.1.0",
"oat-sa/extension-tao-itemqti" : ">=30.10.0",
"oat-sa/extension-tao-test" : ">=16.0.0",
Expand Down
24 changes: 22 additions & 2 deletions models/classes/xmlEditor/XmlEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@
namespace oat\taoQtiTest\models\xmlEditor;

use core_kernel_classes_Resource;
use oat\generis\model\GenerisRdf;
use oat\oatbox\service\ConfigurableService;
use oat\tao\model\featureFlag\FeatureFlagChecker;
use oat\tao\model\featureFlag\FeatureFlagCheckerInterface;
use oat\tao\model\user\implementation\UserSettingsService;
use oat\tao\model\user\UserSettingsInterface;
use oat\tao\model\user\UserSettingsServiceInterface;
use qtism\data\storage\xml\XmlDocument;
use taoQtiTest_models_classes_QtiTestService;

Expand Down Expand Up @@ -59,6 +64,16 @@ public function saveStringTest(core_kernel_classes_Resource $test, string $testS
*/
public function isLocked(): bool
{
$userSettings = $this->getUserSettingsService()->getCurrentUserSettings();

if (
$userSettings->getSetting(
UserSettingsInterface::INTERFACE_MODE
) === GenerisRdf::PROPERTY_USER_INTERFACE_MODE_SIMPLE
) {
return true;
}

if (
$this->getFeatureFlagChecker()->isEnabled(self::FEATURE_FLAG_XML_EDITOR_ENABLED)
|| $this->getFeatureFlagChecker()->isEnabled(self::LEGACY_FEATURE_FLAG_XML_EDITOR_ENABLED)
Expand All @@ -71,11 +86,16 @@ public function isLocked(): bool

private function getTestService(): taoQtiTest_models_classes_QtiTestService
{
return $this->getServiceLocator()->get(taoQtiTest_models_classes_QtiTestService::class);
return $this->getServiceManager()->getContainer()->get(taoQtiTest_models_classes_QtiTestService::class);
}

private function getFeatureFlagChecker(): FeatureFlagChecker
private function getFeatureFlagChecker(): FeatureFlagCheckerInterface
{
return $this->getServiceManager()->getContainer()->get(FeatureFlagChecker::class);
}

public function getUserSettingsService(): UserSettingsServiceInterface
{
return $this->getServiceManager()->getContainer()->get(UserSettingsService::class);
}
}
90 changes: 70 additions & 20 deletions test/unit/models/classes/xml/XmlEditorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@
use common_ext_Extension;
use common_ext_ExtensionsManager;
use core_kernel_classes_Resource;
use oat\generis\model\GenerisRdf;
use oat\tao\model\featureFlag\FeatureFlagChecker;
use oat\tao\model\featureFlag\FeatureFlagCheckerInterface;
use oat\tao\model\user\implementation\UserSettings;
use oat\tao\model\user\implementation\UserSettingsService;
use oat\tao\model\user\UserSettingsInterface;
use oat\taoQtiTest\models\xmlEditor\XmlEditor;
use oat\taoQtiTest\models\xmlEditor\XmlEditorInterface;
use PHPUnit\Framework\MockObject\MockObject;
use qtism\data\storage\xml\XmlDocument;
use qtism\data\storage\xml\XmlStorageException;
Expand Down Expand Up @@ -52,6 +58,9 @@ class XmlEditorTest extends TestCase
/** @var FeatureFlagChecker|MockObject */
private $featureFlagCheckerMock;

/** @var UserSettingsService|MockObject */
private $userSettingsService;

public function setUp(): void
{
$doc = new XmlDocument();
Expand All @@ -65,10 +74,12 @@ public function setUp(): void
->with($this->testResourceMock)
->willReturn($this->xmlDoc);
$this->featureFlagCheckerMock = $this->createMock(FeatureFlagChecker::class);
$this->userSettingsService = $this->createMock(UserSettingsService::class);

$this->serviceLocatorMock = $this->getServiceLocatorMock([
taoQtiTest_models_classes_QtiTestService::class => $this->qtiTestServiceMock,
FeatureFlagChecker::class => $this->featureFlagCheckerMock,
UserSettingsService::class => $this->userSettingsService
]);
}

Expand Down Expand Up @@ -175,46 +186,85 @@ public function testSaveStringTest()
/**
* @dataProvider getFeatureIsLockedData
*/
public function testIsLocked($configFlag, $newFeatureFlag, $legacyFeatureFlag, $expectedLock)
public function testIsLocked(array $options): void
{
$service = new XmlEditor([XmlEditor::OPTION_XML_EDITOR_LOCK => $configFlag]);
$userSettings = $this->createMock(UserSettings::class);
$userSettings->method('getSetting')
->with(UserSettingsInterface::INTERFACE_MODE)
->willReturn($options['interfaceMode']);

$this->userSettingsService
->method('getCurrentUserSettings')
->willReturn($userSettings);

$service = new XmlEditor([XmlEditorInterface::OPTION_XML_EDITOR_LOCK => $options['configFlag']]);
$service->setServiceLocator($this->serviceLocatorMock);

$this->featureFlagCheckerMock
->method('isEnabled')
->withConsecutive(['FEATURE_FLAG_XML_EDITOR_ENABLED'], ['XML_EDITOR_ENABLED'])
->willReturnOnConsecutiveCalls($newFeatureFlag, $legacyFeatureFlag);
->willReturnOnConsecutiveCalls($options['xmlEditorEnabled'], $options['legacyXmlEditorEnabled']);

$this->assertEquals($expectedLock, $service->isLocked());
$this->assertEquals($options['expectedLock'], $service->isLocked());
}

public function getFeatureIsLockedData(): array
{
return [
'unlocked by config' => [
false,
false,
false,
false
'options' => [
'configFlag' => false,
'xmlEditorEnabled' => false,
'legacyXmlEditorEnabled' => false,
'interfaceMode' => GenerisRdf::PROPERTY_USER_INTERFACE_MODE_ADVANCED,
'expectedLock' => false
]
],
'unlocked by new feature flag' => [
true,
true,
false,
false
'options' => [
'configFlag' => true,
'xmlEditorEnabled' => true,
'legacyXmlEditorEnabled' => false,
'interfaceMode' => GenerisRdf::PROPERTY_USER_INTERFACE_MODE_ADVANCED,
'expectedLock' => false
]
],
'unlocked by legacy feature flag' => [
true,
false,
true,
false
'options' => [
'configFlag' => true,
'xmlEditorEnabled' => false,
'legacyXmlEditorEnabled' => true,
'interfaceMode' => GenerisRdf::PROPERTY_USER_INTERFACE_MODE_ADVANCED,
'expectedLock' => false
]
],
'locked' => [
true,
false,
false,
true
'options' => [
'configFlag' => true,
'xmlEditorEnabled' => false,
'legacyXmlEditorEnabled' => false,
'interfaceMode' => GenerisRdf::PROPERTY_USER_INTERFACE_MODE_ADVANCED,
'expectedLock' => true
]
],
'enabled but locked but simple interface' => [
'options' => [
'configFlag' => true,
'xmlEditorEnabled' => true,
'legacyXmlEditorEnabled' => true,
'interfaceMode' => GenerisRdf::PROPERTY_USER_INTERFACE_MODE_SIMPLE,
'expectedLock' => true
]
],
'enabled with advanced interface mode' => [
'options' => [
'configFlag' => true,
'xmlEditorEnabled' => true,
'legacyXmlEditorEnabled' => true,
'interfaceMode' => GenerisRdf::PROPERTY_USER_INTERFACE_MODE_ADVANCED,
'expectedLock' => false
]
]
];
}
}
54 changes: 54 additions & 0 deletions views/js/controller/creator/helpers/featureVisibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ define(['services/features'], function (features) {
if (features.isVisible('taoQtiTest/creator/test/property/timeLimits')) {
model.showTimeLimits = true;
}
if (features.isVisible('taoQtiTest/creator/test/property/identifier')) {
model.showIdentifier = true;
}
if (features.isVisible('taoQtiTest/creator/test/property/lateSubmission')) {
model.lateSubmission = true;
}
if (features.isVisible('taoQtiTest/creator/test/property/outcomeDeclarations')) {
model.showOutcomeDeclarations = true;
}
}

/**
Expand All @@ -39,6 +48,18 @@ define(['services/features'], function (features) {
if (features.isVisible(`${propertyNamespace}timeLimits`)) {
model.showTimeLimits = true;
}
if (features.isVisible(`${propertyNamespace}identifier`)) {
model.showIdentifier = true;
}
if (features.isVisible(`${propertyNamespace}lateSubmission`)) {
model.lateSubmission = true;
}
if (features.isVisible(`${propertyNamespace}itemSessionControl`)) {
model.showItemSessionControl = true;
}
if (features.isVisible(`${propertyNamespace}navigationWarnings`)) {
model.showNavigationWarnings = true;
}
if (features.isVisible(`${propertyNamespace}itemSessionControl/showFeedback`)) {
model.itemSessionShowFeedback = true;
}
Expand All @@ -48,6 +69,12 @@ define(['services/features'], function (features) {
if (features.isVisible(`${propertyNamespace}itemSessionControl/allowSkipping`)) {
model.itemSessionAllowSkipping = true;
}
if (features.isVisible(`${propertyNamespace}weights`)) {
model.showWeights = true;
}
if (features.isVisible(`${propertyNamespace}itemSessionControl/validateResponses`)) {
model.showWeights = true;
}
}

/**
Expand All @@ -59,6 +86,21 @@ define(['services/features'], function (features) {
if (features.isVisible(`${propertyNamespace}timeLimits`)) {
model.showTimeLimits = true;
}
if (features.isVisible(`${propertyNamespace}identifier`)) {
model.showIdentifier = true;
}
if (features.isVisible(`${propertyNamespace}visible`)) {
model.showVisible = true;
}
if (features.isVisible(`${propertyNamespace}keepTogether`)) {
model.showKeepTogether = true;
}
if (features.isVisible(`${propertyNamespace}property/lateSubmission`)) {
model.lateSubmission = true;
}
if (features.isVisible(`${propertyNamespace}itemSessionControl/validateResponses`)) {
model.validateResponsesVisible = true;
}
if (features.isVisible(`${propertyNamespace}itemSessionControl/showFeedback`)) {
model.itemSessionShowFeedback = true;
}
Expand All @@ -68,6 +110,9 @@ define(['services/features'], function (features) {
if (features.isVisible(`${propertyNamespace}itemSessionControl/allowSkipping`)) {
model.itemSessionAllowSkipping = true;
}
if (features.isVisible(`${propertyNamespace}rubricBlocks/class`)) {
model.rubricBlocksClass = true;
}
}

/**
Expand All @@ -79,6 +124,15 @@ define(['services/features'], function (features) {
if (features.isVisible(`${propertyNamespace}timeLimits`)) {
model.showTimeLimits = true;
}
if (features.isVisible(`${propertyNamespace}identifier`)) {
model.showIdentifier = true;
}
if (features.isVisible(`${propertyNamespace}reference`)) {
model.showReference = true;
}
if (features.isVisible(`${propertyNamespace}lateSubmission`)) {
model.lateSubmission = true;
}
if (features.isVisible(`${propertyNamespace}itemSessionControl/showFeedback`)) {
model.itemSessionShowFeedback = true;
}
Expand Down
9 changes: 7 additions & 2 deletions views/js/controller/creator/helpers/scoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ define([
'core/format',
'taoQtiTest/controller/creator/helpers/baseType',
'taoQtiTest/controller/creator/helpers/outcome',
'taoQtiTest/controller/creator/helpers/processingRule'
], function (_, __, format, baseTypeHelper, outcomeHelper, processingRuleHelper) {
'taoQtiTest/controller/creator/helpers/processingRule',
'services/features'
], function (_, __, format, baseTypeHelper, outcomeHelper, processingRuleHelper, features) {
'use strict';

/**
Expand Down Expand Up @@ -890,6 +891,10 @@ define([
*/
function detectScoring(modelOverseer) {
var model = modelOverseer.getModel();
let modes = processingModes;
if(!features.isVisible('taoQtiTest/creator/test/property/scoring/custom')) {
delete modes.custom;
}
return {
modes: processingModes,
scoreIdentifier: defaultScoreIdentifier,
Expand Down
Loading
Loading