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

fix: this PR fixes the import of test packages (.zip files) that have no metadata #2509

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
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
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 @@ -501,7 +501,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 @@ -785,7 +785,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 @@ -815,7 +815,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 @@ -1451,7 +1451,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
Loading