Skip to content

Commit

Permalink
chore: fix CI, simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
shpran committed Aug 7, 2024
1 parent 2fa9935 commit 78db3dc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
6 changes: 1 addition & 5 deletions actions/class.RestQtiTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,7 @@ private function getOverwriteTestUri(): ?string
{
$overwriteTestUri = $this->getPostParameter(self::OVERWRITE_TEST_URI);

if (is_null($overwriteTestUri)) {
return null;
}

if (!is_string($overwriteTestUri)) {
if (!is_null($overwriteTestUri) && !is_string($overwriteTestUri)) {
throw new common_exception_RestApi(
sprintf('%s parameter should be string', self::OVERWRITE_TEST_URI)
);
Expand Down
5 changes: 3 additions & 2 deletions models/classes/class.QtiTestService.php
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,9 @@ protected function importTest(
$this->importTestAuxiliaryFiles($testContent, $qtiTestResource, $folder, $report);

// 3. Give meaningful names to resources.
$testResource->setLabel($newPackageLabel ?? $testDefinition->getDocumentComponent()->getTitle());
$targetItemClass->setLabel($newPackageLabel ?? $testDefinition->getDocumentComponent()->getTitle());
$testDefinitionTitle = $testDefinition->getDocumentComponent()->getTitle();
$testResource->setLabel($newPackageLabel ?? $testDefinitionTitle);
$targetItemClass->setLabel($newPackageLabel ?? $testDefinitionTitle);

// 4. Import metadata for the resource (use same mechanics as item resources).
// Metadata will be set as property values.
Expand Down
8 changes: 4 additions & 4 deletions models/classes/import/QtiTestImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class QtiTestImporter extends AbstractTestImporter
public function import(
File $file,
core_kernel_classes_Class $class = null,
bool $enableMetadataGuardians = true,
bool $enableValidators = true,
bool $itemMustExist = false,
bool $itemMustBeOverwritten = false,
$enableMetadataGuardians = true,
$enableValidators = true,
$itemMustExist = false,
$itemMustBeOverwritten = false,
bool $overwriteTest = false,
?string $itemClassUri = null,
?string $newPackageLabel = null,
Expand Down

0 comments on commit 78db3dc

Please sign in to comment.