19 declare(strict_types=1);
49 return array_keys($eval->getParticipant($active_id)->getPasses());
56 $found_participants = $eval->getParticipants();
57 if ($found_participants === []) {
62 $total_passed_reached = 0.0;
63 $total_passed_max = 0.0;
64 $total_passed_time = 0;
65 foreach ($found_participants as $userdata) {
66 if ($userdata->getMark()?->getPassed()) {
68 $total_passed_reached += $userdata->getReached();
69 $total_passed_max += $userdata->getMaxpoints();
70 $total_passed_time += $userdata->getTimeOnTask();
76 count($found_participants),
77 $eval->getTotalFinishedParticipants(),
81 $eval->getStatistics()->rankMedian(),
82 $eval->getStatistics()->getEvaluationDataOfMedianUser()?->getMark()?->getShortName() ??
'',
83 $eval->getStatistics()->median(),
84 $total_passed === 0 ? 0 : $total_passed_reached / $total_passed
95 $found_participants = $eval->getParticipants();
96 $participant_data = $eval->getParticipant($active_id);
97 if ($attempt_id ===
null) {
98 $attempt_id = $participant_data?->getScoredPass();
100 if ($found_participants === []
101 || $attempt_id ===
null) {
105 $attempt_data = $participant_data?->getPass($attempt_id);
106 if ($attempt_data ===
null) {
114 $attempt_data->getExamId(),
115 $attempt_data->getReachedPoints(),
116 $attempt_data->getMaxPoints(),
117 $attempt_data->getMark(),
118 $attempt_data->getAnsweredQuestionCount(),
119 $attempt_data->getQuestionCount(),
120 $attempt_data->getRequestedHintsCount(),
121 $attempt_data->getWorkingTime(),
122 $participant_data->getTimeOnTask(),
123 $attempt_data->getStartTime(),
124 $attempt_data->getLastAccessTime(),
125 $participant_data->getPassCount(),
126 $participant_data->getScoredPass(),
127 $eval->getStatistics()->rank($participant_data->getReached()),
128 $attempt_data->getStatusOfAttempt()
155 if ($scored_attempt !==
null 156 && $scored_attempt->getStatusOfAttempt() === StatusOfAttempt::RUNNING
157 && $scored_attempt->getStartedDate() !==
null) {
192 $question_results = [];
198 $settings->getShowHiddenQuestions(),
199 $settings->getShowOptionalQuestions()
203 $graphical_output =
false;
204 $result_output =
false;
205 $show_question_only = $settings->getQuestionTextOnly();
206 $show_feedback =
false;
207 $show_correct_solution =
false;
208 $show_manual_scoring =
false;
209 $show_question_text =
true;
210 $show_inline_feedback =
true;
212 foreach (
$results as $idx => $qresult) {
213 if (!is_numeric($idx)) {
217 $qid = $qresult[
'qid'];
218 $type = $qresult[
'type'];
219 $title = $qresult[
'title'];
220 $question_score = $qresult[
'max'];
221 $usr_score = $qresult[
'reached'];
222 $workedthrough = (bool) $qresult[
'workedthrough'];
223 $answered = (bool) $qresult[
'answered'];
224 $requested_hints = (
int) $qresult[
'requested_hints'];
228 $shuffle_trafo = $this->shuffler->getAnswerShuffleFor($qid, $active_id, $attempt_id);
229 $question = $question_gui->getObject();
230 $question->setShuffler($shuffle_trafo);
231 $question_gui->setObject($question);
233 $graphical_output =
true;
234 $show_correct_solution =
false;
235 $show_feedback = $settings->getShowFeedback();
236 $usr_solution = $question_gui->getSolutionOutput(
243 $show_correct_solution,
244 $show_manual_scoring,
246 $show_inline_feedback
250 $type ===
'assTextQuestion' 252 $usr_solution .= $question_gui->getAutoSavedSolutionOutput(
266 $graphical_output =
false;
267 $show_correct_solution =
true;
268 $show_feedback =
false;
269 $show_inline_feedback =
false;
270 $best_solution = $question_gui->getSolutionOutput(
277 $show_correct_solution,
278 $show_manual_scoring,
280 $show_inline_feedback
283 if ($show_question_only) {
284 $usr_solution = $this->ui_renderer->render($this->ui_factory->legacy()->content(
'<div class="ilc_question_Standard">' . $usr_solution .
'</div>'));
285 $best_solution = $this->ui_renderer->render($this->ui_factory->legacy()->content(
'<div class="ilc_question_Standard">' . $best_solution .
'</div>'));
288 $feedback = $question_gui->getGenericFeedbackOutput($active_id, $attempt_id);
290 $recapitulation =
null;
291 if ($is_user_output && $settings->getShowRecapitulation()) {
292 $recapitulation = $question_gui->getObject()->getSuggestedSolutionOutput();
320 if (!isset($this->test_data[$test_obj->
getId()])) {
324 return $this->test_data[$test_obj->
getId()];
withRunningAttemptStart(\DateTimeImmutable $start_date)
retrieveResultData(\ilObjTest $test_obj)
getOverviewDataForTest(\ilObjTest $test_obj)
getAttemptIdsArrayFor(\ilObjTest $test_obj, int $active_id)
withAttemptOverviewInformation(?AttemptOverview $attempt_overview)
createQuestionGUI($question_type, $question_id=-1)
Creates a question GUI instance of a given question type.
evalTotalStartedAverageTime(?array $active_ids_to_filter=null)
getTestResult(int $active_id, ?int $pass=null, bool $ordered_sequence=false, bool $consider_hidden_questions=true, bool $consider_optional_questions=true)
Calculates the results of a test for a given user and returns an array with all test results...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getAttemptOverviewFor(ResultPresentationSettings $settings, \ilObjTest $test_obj, int $active_id, ?int $attempt_id)
getCompleteEvaluationData($filterby='', $filtertext='')
buildAttemptResults(ResultPresentationSettings $settings, \ilObjTest $test_obj, int $active_id, int $attempt_id, bool $is_user_output)
__construct(protected \ilTestShuffler $shuffler, protected UIFactory $ui_factory, protected UIRenderer $ui_renderer)
getAttemptResultsFor(ResultPresentationSettings $settings, \ilObjTest $test_obj, int $active_id, int $attempt_id, bool $is_user_output)
addAttemptOverviewInformationToParticipants(ResultPresentationSettings $settings, \ilObjTest $test_obj, array $participants)