Skip to content

Commit

Permalink
Test: Ensure All Attempts Are in Evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
kergomard committed Dec 16, 2024
1 parent 94bff3f commit 53f86eb
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions Modules/Test/classes/Evaluation/class.ilTestEvaluationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,12 @@ public function getEvaluationData(): ilTestEvaluationData
$scoring_settings = $this->getPassScoringSettings();
$participants = [];
$current_user = null;
$current_attempt = null;

foreach ($eval_data_rows as $row) {
if ($current_user != $row['active_fi']) {
if ($current_user !== $row['active_fi']) {
$current_user = $row['active_fi'];
$current_attempt = null;

$user_eval_data = new ilTestEvaluationUserData($scoring_settings);

Expand All @@ -157,36 +159,37 @@ public function getEvaluationData(): ilTestEvaluationData
$user_eval_data->setSubmitted((bool) $row['submitted']);
$user_eval_data->setLastFinishedPass($row['last_finished_pass']);


$visitingTime = $this->getVisitTimeOfParticipant($row['active_fi']);
$user_eval_data->setFirstVisit($visitingTime["firstvisit"]);
$user_eval_data->setLastVisit($visitingTime["lastvisit"]);
$user_eval_data->setFirstVisit($visitingTime['firstvisit']);
$user_eval_data->setLastVisit($visitingTime['lastvisit']);
}

$pass = new \ilTestEvaluationPassData();
$pass->setPass($row['pass']);
$pass->setReachedPoints($row['points']);
$pass->setObligationsAnswered((bool) $row['obligations_answered']);
if ($current_attempt !== $row['pass']) {
$attempt = new \ilTestEvaluationPassData();
$attempt->setPass($row['pass']);
$attempt->setReachedPoints($row['points']);
$attempt->setObligationsAnswered((bool) $row['obligations_answered']);

if ($row['questioncount'] == 0) {
list($count, $points) = array_values(
$this->getQuestionCountAndPointsForPassOfParticipant($row['active_fi'], $row['pass'])
);
$pass->setMaxPoints($points);
$pass->setQuestionCount($count);
$attempt->setMaxPoints($points);
$attempt->setQuestionCount($count);
} else {
$pass->setMaxPoints($row['maxpoints']);
$pass->setQuestionCount($row['questioncount']);
$attempt->setMaxPoints($row['maxpoints']);
$attempt->setQuestionCount($row['questioncount']);
}

$pass->setNrOfAnsweredQuestions($row['answeredquestions']);
$pass->setWorkingTime($row['workingtime']);
$pass->setExamId((string) $row['exam_id']);
$pass->setRequestedHintsCount($row['hint_count']);
$pass->setDeductedHintPoints($row['hint_points']);
$attempt->setNrOfAnsweredQuestions($row['answeredquestions']);
$attempt->setWorkingTime($row['workingtime']);
$attempt->setExamId((string) $row['exam_id']);
$attempt->setRequestedHintsCount($row['hint_count']);
$attempt->setDeductedHintPoints($row['hint_points']);
}

if ($row['question_fi'] !== null) {
$pass->addAnsweredQuestion(
$attempt->addAnsweredQuestion(
$row["question_fi"],
$row["qpl_maxpoints"],
$row["result_points"],
Expand All @@ -196,7 +199,7 @@ public function getEvaluationData(): ilTestEvaluationData
);
}

$user_eval_data->addPass($row['pass'], $pass);
$user_eval_data->addPass($row['pass'], $attempt);

$participants[$row['active_fi']] = $user_eval_data;
}
Expand Down

0 comments on commit 53f86eb

Please sign in to comment.