19 declare(strict_types=1);
31 return $this->test_obj->getPassScoring();
36 return $this->test_obj->isRandomTest();
41 return $this->test_obj->getQuestionCountWithoutReloading();
46 return $this->test_obj->getMarkSchema();
51 return $this->test_obj->getVisitTimeOfParticipant($active_id);
66 if (($participants_list = $this->test_obj->getAccessFilteredParticipantList()) !== null) {
67 return $participants_list->getAllActiveIds();
69 $participants = $this->test_obj->getTestParticipants();
70 return array_keys($participants);
79 SELECT tst_test_result.question_fi, 80 tst_test_result.points result_points, 81 tst_test_result.answered, 82 tst_test_result.manual, 84 qpl_questions.original_id, 85 qpl_questions.title questiontitle, 86 qpl_questions.points qpl_maxpoints, 90 tst_active.last_finished_pass, 101 LEFT JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi 102 LEFT JOIN tst_test_result ON tst_active.active_id = tst_test_result.active_fi AND tst_test_result.pass = tst_pass_result.pass 103 LEFT JOIN qpl_questions ON qpl_questions.question_id = tst_test_result.question_fi 104 LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id 106 WHERE tst_active.test_fi = %s 109 ORDER BY tst_active.active_id ASC, tst_pass_result.pass ASC, tst_test_result.tstamp DESC 112 $result = $this->db->query(
115 $this->db->quote($this->test_obj->getTestId(),
'integer'),
116 $this->db->in(
'tst_active.active_id', $active_ids,
false,
'integer'),
120 while ($row = $this->db->fetchAssoc($result)) {
130 $current_user = null;
131 $current_attempt = null;
133 foreach ($eval_data_rows as $row) {
134 if ($current_user !== $row[
'active_id']) {
135 $current_user = $row[
'active_id'];
136 $current_attempt = null;
140 if ($current_attempt !== $row[
'pass']) {
141 $current_attempt = $row[
'pass'];
146 $user_eval_data->addPass($row[
'pass'], $attempt);
147 $participants[$row[
'active_id']] = $user_eval_data;
156 $current_user = null;
157 $current_attempt = null;
159 foreach ($eval_data_rows as $row) {
160 if($row[
'pass'] === null) {
164 if ($current_user !== $row[
'active_id']) {
165 $current_user = $row[
'active_id'];
166 $current_attempt = null;
173 if ($current_attempt !== $row[
'pass']) {
174 $current_attempt = $row[
'pass'];
182 $user_eval_data->addPass($row[
'pass'], $attempt);
183 $participants[$row[
'active_id']] = $user_eval_data;
197 $this->test_obj->buildName($row[
'usr_id'], $row[
'firstname'], $row[
'lastname'])
200 if ($row[
'login'] !== null) {
201 $user_data->setLogin($row[
'login']);
203 if ($row[
'usr_id'] !== null) {
204 $user_data->setUserID($row[
'usr_id']);
206 $user_data->setSubmitted((
bool) $row[
'submitted']);
207 $user_data->setLastFinishedPass($row[
'last_finished_pass']);
213 $attempt = new \ilTestEvaluationPassData();
214 $attempt->setPass($row[
'pass']);
215 $attempt->setReachedPoints($row[
'points']);
216 $attempt->setObligationsAnswered((
bool) $row[
'obligations_answered']);
217 $attempt->setNrOfAnsweredQuestions($row[
'answeredquestions']);
218 $attempt->setWorkingTime($row[
'workingtime']);
219 $attempt->setExamId((
string) $row[
'exam_id']);
220 $attempt->setRequestedHintsCount($row[
'hint_count']);
221 $attempt->setDeductedHintPoints($row[
'hint_points']);
239 if ($row[
'questioncount'] !== 0) {
245 list($count, $points) = array_values(
257 if ($row[
'question_fi'] === null) {
263 $row[
"qpl_maxpoints"],
264 $row[
"result_points"],
265 (
bool) $row[
'answered'],
283 foreach ($add_user_questions as
$q) {
285 $original_id = $q[
'original_id'];
286 $question_id = $q[
'question_id'];
287 $max_points = $q[
'max_points'];
288 $sequence = $q[
'sequence'];
290 $title = $q[
'title'];
292 $user_eval_data->addQuestion(
304 return $evaluation_data;
313 for ($testpass = 0; $testpass <= $user_eval_data->
getLastPass(); $testpass++) {
314 $this->db->setLimit($question_count, 0);
316 SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, qpl_questions.original_id, 317 tst_test_rnd_qst.pass, qpl_questions.points, qpl_questions.title 318 FROM tst_test_rnd_qst, qpl_questions 319 WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id 320 AND tst_test_rnd_qst.pass = %s 321 AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence 324 $result = $this->db->queryF(
326 [
'integer',
'integer'],
327 [$testpass, $active_id]
330 if ($result->numRows()) {
331 while ($row = $this->db->fetchAssoc($result)) {
332 $tpass = array_key_exists(
"pass", $row) ? $row[
"pass"] : 0;
335 !isset($row[
"question_fi"], $row[
"points"], $row[
"sequence"]) ||
336 !is_numeric($row[
"question_fi"]) || !is_numeric($row[
"points"]) || !is_numeric($row[
"sequence"])
342 'original_id' => (
int) $row[
"original_id"],
343 'question_id' => (
int) $row[
"question_fi"],
344 'max_points' => (float) $row[
"points"],
345 'sequence' => (
int) $row[
"sequence"],
347 'title' => $row[
"title"]
361 SELECT tst_test_question.sequence, tst_test_question.question_fi, 362 qpl_questions.points, qpl_questions.title, qpl_questions.original_id 363 FROM tst_test_question, tst_active, qpl_questions 364 WHERE tst_test_question.question_fi = qpl_questions.question_id 365 AND tst_active.active_id = %s 366 AND tst_active.test_fi = tst_test_question.test_fi 367 ORDER BY tst_test_question.sequence 370 $result = $this->db->queryF(
376 if ($result->numRows()) {
377 $questionsbysequence = [];
378 while ($row = $this->db->fetchAssoc($result)) {
379 $questionsbysequence[$row[
'sequence']] = $row;
382 $seqresult = $this->db->queryF(
383 "SELECT * FROM tst_sequence WHERE active_fi = %s",
388 while ($seqrow = $this->db->fetchAssoc($seqresult)) {
389 $questionsequence = unserialize($seqrow[
'sequence']);
390 foreach ($questionsequence as $sidx => $seq) {
391 if (!isset($questionsbysequence[$seq])) {
395 'original_id' => $questionsbysequence[$seq][
'original_id'] ?? 0,
396 'question_id' => $questionsbysequence[$seq][
'question_fi'],
397 'max_points' => $questionsbysequence[$seq][
'points'],
398 'sequence' => $sidx + 1,
399 'pass' => $seqrow[
'pass'],
400 'title' => $questionsbysequence[$seq][
"title"]
415 $percentage = $user_eval_data->getReachedPointsInPercent();
416 $mark = $mark_schema->getMatchingMark($percentage);
418 if (is_object($mark)) {
419 $user_eval_data->setMark($mark->getShortName());
420 $user_eval_data->setMarkOfficial($mark->getOfficialName());
422 $user_eval_data->setPassed(
423 $mark->getPassed() && $user_eval_data->areObligationsAnswered()
428 return $evaluation_data;
addAnsweredQuestion(int $question_id, float $max_points, float $reached_points, bool $isAnswered, ?int $sequence=null, int $manual=0)
queryEvaluationData(array $active_ids)
getQuestionsForParticipantPassesForSequencedTests(int $active_id)
getCorrectionsEvaluationData()
getQuestionsForParticipantPassesForRandomTests(int $active_id, ilTestEvaluationUserData $user_eval_data, int $question_count)
addPointsAndQuestionCountToAttempt(ilTestEvaluationPassData $attempt, array $row)
addQuestionsToParticipantPasses(ilTestEvaluationData $evaluation_data)
setQuestionCount(int $questioncount)
getQuestionCountAndPointsForPassOfParticipant(int $active_id, int $pass)
static _getQuestionCountAndPointsForPassOfParticipant($active_id, $pass)
buildBasicUserEvaluationDataFromDB(array $row)
setMaxPoints(float $maxpoints)
buildBasicAttemptEvaluationDataFromDB(array $row)
addVisitingTimeToUserEvalData(ilTestEvaluationUserData $user_data, int $active_id)
addMarksToParticipants(ilTestEvaluationData $evaluation_data)
addQuestionToAttempt(ilTestEvaluationPassData $attempt, array $row)
A class defining mark schemas for assessment test objects.
addQuestionTitle(int $question_id, string $question_title)
__construct(protected ilDBInterface $db, protected ilObjTest $test_obj)
getParticipant(int $active_id)
getVisitTimeOfParticipant(int $active_id)
getAccessFilteredActiveIds()