Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
use ILIAS\Data\Range;
use ILIAS\Data\Order;
use ILIAS\Language\Language;
use ILIAS\Test\Results\Data\Factory as TestResultsDataFactory;
use ILIAS\Test\Results\Presentation\Factory as TestResultsPresentationFactory;

class ScoringByQuestionTableBinder implements DataRetrieval
{
Expand All @@ -35,6 +37,8 @@ public function __construct(
private readonly Language $lng,
private readonly \DateTimeZone $timezone,
private readonly \ilTestParticipantAccessFilterFactory $participant_access_filter_factory,
private readonly TestResultsDataFactory $results_data_factory,
private readonly TestResultsPresentationFactory $results_presentation_factory,
private readonly \ilObjTest $test_obj,
private readonly int $question_id
) {
Expand Down Expand Up @@ -154,6 +158,21 @@ function (
array $c,
\ilTestEvaluationPassData $pd
) use ($question_id, $active_id, $filtered_participants, $complete_feedback): array {
$is_finished = $this
->results_data_factory
->getAttemptOverviewFor(
$this->results_presentation_factory->getAttemptResultsSettings($this->test_obj, false),
$this->test_obj,
$active_id,
$pd->getPass()
)
?->getStatusOfAttempt()
?->isFinished() ?? false;

if (!$is_finished) {
return $c;
}

$question_result = $pd->getAnsweredQuestionByQuestionId($question_id);
$feedback_data = $complete_feedback[$active_id][$pd->getPass()][$question_id] ?? [];
if ($this->isFilteredAttempt($pd, $question_result, $feedback_data)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,25 @@ protected function showManScoringByQuestionParticipantsTable(

if ($this->testrequest->strVal($this->action_parameter_token->getName()) === ScoringByQuestionTable::ACTION_SCORING) {
$affected_rows = $this->testrequest->raw($this->row_id_token->getName());
$this->getAnswerDetail($question_id, $affected_rows[0]);
[$active_id, $attempt] = explode('_', $affected_rows[0]);

$is_finished = $this
->results_data_factory
->getAttemptOverviewFor(
$this->results_presentation_factory->getAttemptResultsSettings($this->object, false),
$this->object,
(int) $active_id,
(int) $attempt
)
?->getStatusOfAttempt()
?->isFinished() ?? false;

if ($is_finished) {
$this->getAnswerDetail($question_id, $affected_rows[0]);
return;
}

throw new \Exception('Test attempt is not finished');
}

$content = [
Expand All @@ -140,6 +158,8 @@ protected function showManScoringByQuestionParticipantsTable(
$this->lng,
new \DateTimeZone($this->user->getTimeZone()),
$this->participant_access_filter,
$this->results_data_factory,
$this->results_presentation_factory,
$this->object,
$question_id
)
Expand Down
Loading