Skip to content

Commit

Permalink
Merge pull request #2511 from oat-sa/fix/backport/import-test-wihtout…
Browse files Browse the repository at this point in the history
…-metadata

Backport fix import QTI Package without metadata
  • Loading branch information
bartlomiejmarszal authored Oct 2, 2024
2 parents 03c4aba + 577db24 commit b8855c4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions models/classes/class.QtiTestService.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) 2013-2023 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
* Copyright (c) 2013-2024 (original work) Open Assessment Technologies SA;
*/

use League\Flysystem\FileExistsException;
Expand Down Expand Up @@ -497,7 +497,7 @@ public function clearRelatedResources(common_report_Report $report): void

// 2. Restore overwritten item contents.
foreach ($data->overwrittenItems as $overwrittenItemId => $backupName) {
common_Logger::d("Restoring content for item '${overwrittenItemId}'...");
common_Logger::d("Restoring content for item '{$overwrittenItemId}'...");
@Service::singleton()->restoreContentByRdfItem(
new core_kernel_classes_Resource($overwrittenItemId),
$backupName
Expand Down Expand Up @@ -776,7 +776,7 @@ protected function importTest(

// If items did not produce errors, we import the test definition.
if ($itemError === false) {
common_Logger::i("Importing test with manifest identifier '${qtiTestResourceIdentifier}'...");
common_Logger::i("Importing test with manifest identifier '{$qtiTestResourceIdentifier}'...");

// Second step is to take care of the test definition and the related media (auxiliary files).

Expand Down Expand Up @@ -805,7 +805,7 @@ protected function importTest(
if ($this->getServiceManager()->getContainer()->has(MappedMetadataInjector::class)) {
$this->getServiceManager()->getContainer()->get(MappedMetadataInjector::class)->inject(
$mappedProperties['testProperties'] ?? [],
$metadataValues[$qtiTestResourceIdentifier],
$metadataValues[$qtiTestResourceIdentifier] ?? [],
$testResource
);
}
Expand Down Expand Up @@ -1447,7 +1447,6 @@ protected function getMetadataImporter()
private function getMetaMetadataExtractor(): MetaMetadataExtractor
{
return $this->getPsrContainer()->get(MetaMetadataExtractor::class);
return $this->getServiceManager()->getContainer()->get(MetaMetadataExtractor::class);
}

private function getSecureResourceService(): SecureResourceServiceInterface
Expand Down

0 comments on commit b8855c4

Please sign in to comment.