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

T&A Bugfix #0042396: Fix Test Scoring Settings for Import/Export #8412

Open
wants to merge 4 commits into
base: release_8
Choose a base branch
from
Open
Show file tree
Hide file tree
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: 5 additions & 4 deletions Modules/Test/classes/class.ilObjTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5095,7 +5095,7 @@ public function fromXML(ilQTIAssessment $assessment)
$this->setFixedParticipants($metadata["entry"]);
break;
case "score_reporting":
$this->setScoreReporting((int) $metadata["entry"]);
$result_summary_settings = $result_summary_settings->withScoreReporting((int) $metadata["entry"]);
break;
case "shuffle_questions":
$this->setShuffleQuestions($metadata["entry"]);
Expand Down Expand Up @@ -5254,6 +5254,7 @@ public function fromXML(ilQTIAssessment $assessment)
}

$this->saveToDb();
$result_summary_settings = $result_summary_settings->withShowPassDetails($result_details_settings->getShowPassDetails());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default, the value of results_presentation in the tst_tests table is set to 3 if it is not specified. This results in showPassDetails() always being true.

Subsequently, result_presentation will be set to the corresponding import value (in my case, 0). However, due to this line

$settings->getResultDetailsSettings()
->withShowPassDetails($settings->getResultSummarySettings()->getShowPassDetails())
->toStorage(),

, it will always be set to 1. The reason for this is that PassDetails is true because it inherits the still-existing default value of 3 from the database.

@nhaagen, you seem to be the author of this feature. Please take a look at this and see if there is a better solution.

Best,
@fhelfer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to also be an issue for newer releases

$score_settings = $score_settings
->withGamificationSettings($gamification_settings)
->withScoringSettings($scoring_settings)
Expand Down Expand Up @@ -5447,7 +5448,7 @@ public function toXML(): string
// results presentation
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", null, "results_presentation");
$a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", $this->getResultsPresentation()));
$a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", $this->getScoreSettings()->getResultDetailsSettings()->getResultsPresentation()));
$a_xml_writer->xmlEndTag("qtimetadatafield");

// examid in test pass
Expand All @@ -5471,7 +5472,7 @@ public function toXML(): string
// solution details
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", null, "score_reporting");
$a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", $this->getScoreReporting()));
$a_xml_writer->xmlElement("fieldentry", null, sprintf("%d", $this->getScoreSettings()->getResultSummarySettings()->getScoreReporting()));
$a_xml_writer->xmlEndTag("qtimetadatafield");

$a_xml_writer->xmlStartTag("qtimetadatafield");
Expand Down Expand Up @@ -7946,7 +7947,7 @@ public function setListOfQuestionsDescription($a_value = true)
*/
public function getResultsPresentation(): int
{
return ($this->results_presentation) ? $this->results_presentation : 0;
return $this->getScoreSettings()->getResultDetailsSettings()->getResultsPresentation();
}

/**
Expand Down
16 changes: 2 additions & 14 deletions Modules/Test/test/ilObjTestTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,6 +16,8 @@
*
*********************************************************************/

declare(strict_types=1);

/**
* Class ilObjTestTest
* @author Marvin Beym <[email protected]>
Expand Down Expand Up @@ -425,16 +425,4 @@ public function testListOfQuestions(): void
$this->testObj->setListOfQuestions(1);
$this->assertTrue($this->testObj->getListOfQuestions());
}

public function testResultsPresentation(): void
{
$this->testObj->setResultsPresentation(0);
$this->assertEquals(0, $this->testObj->getResultsPresentation());

$this->testObj->setResultsPresentation(1);
$this->assertEquals(1, $this->testObj->getResultsPresentation());

$this->testObj->setResultsPresentation(22);
$this->assertEquals(22, $this->testObj->getResultsPresentation());
}
}
Loading