19 declare(strict_types=1);
86 $factory = new \ilTestEvaluationFactory($this->db, $this->test);
87 $participants = $factory->getCorrectionsEvaluationData()->getParticipants();
89 foreach ($participants as $active_id => $userdata) {
90 if (is_object($userdata) && is_array($userdata->getPasses())) {
94 $userdata->getUserID()
107 ->getCompleteEvaluationData()
108 ->getParticipant($active_id);
111 $user_data->getPass($pass),
112 $user_data->getUserID(),
116 $this->test_result_repository->updateTestResultCache($active_id);
122 foreach ($passes as $pass => $passdata) {
123 if (is_object($passdata)) {
127 $this->test_result_repository->updateTestResultCache($active_id);
137 foreach ($questions as $question_data) {
150 if ($this->preserve_manual_scores ===
true && $questiondata[
'manual'] === 1) {
154 $q_id = $questiondata[
'id'];
155 if (!isset($this->question_cache[$q_id])) {
156 $this->question_cache[$q_id] = $this->test->createQuestionGUI(
'', $q_id)->getObject();
158 $question = $this->question_cache[$q_id];
160 $old_points = $question->getReachedPoints($active_id, $pass);
161 $reached = $question->adjustReachedPointsByScoringOptions(
162 $question->calculateReachedPoints($active_id, $pass),
172 $question->getMaximumPoints(),
190 bool $manual_scoring =
false 193 $has_changed = $old_points !== $points;
194 if ($has_changed && $points <= $max_points) {
210 $data = $this->test->getQuestionCountAndPointsForPassOfParticipant($active_id, $pass);
217 $result = $this->db->queryF(
218 'SELECT SUM(points) reachedpoints FROM tst_test_result WHERE active_fi = %s AND pass = %s',
232 $logger = $this->test->getTestLogger();
233 if ($logger->isLoggingEnabled()) {
234 $logger->logScoringInteraction(
236 $this->test->getRefId(),
238 $this->scorer->getId(),
251 public function calculateBestSolutionForTest():
string 254 foreach ($this->test->getAllQuestions() as $question) {
256 $question_gui = $this->test->createQuestionGUI(
"", $question[
'question_id']);
257 $solution .=
'<h1>' . $question_gui->getObject()->getTitleForHTMLOutput() .
'</h1>';
258 $solution .= $question_gui->getSolutionOutput(0,
null,
true,
true,
false,
false,
true,
false);
266 $query =
"DELETE FROM tst_test_result WHERE question_fi = %s";
267 $this->db->manipulateF($query, [
'integer'], [$question_id]);
276 foreach ($active_ids as $active_id) {
277 $passSelector = new \ilTestPassesSelector($this->db, $this->test);
278 $passSelector->setActiveId($active_id);
280 foreach ($passSelector->getExistingPasses() as $pass) {
281 $this->test_result_repository->updateTestAttemptResult(
290 $this->test_result_repository->updateTestResultCache($active_id);
297 SELECT COUNT(*) num_manual_scorings 298 FROM tst_test_result tres 299 INNER JOIN tst_active tact 300 ON tact.active_id = tres.active_fi 301 WHERE tact.test_fi = %s 305 $types = [
'integer'];
306 $values = [$this->test->getTestId()];
310 AND tres.question_fi = %s 313 $types[] =
'integer';
317 $res = $this->db->queryF($query, $types, $values);
319 while ($row = $this->db->fetchAssoc(
$res)) {
320 return (
int) $row[
'num_manual_scorings'];
recalculatePasses(\ilTestEvaluationUserData $userdata, int $active_id)
setQuestionId(int $question_id)
TestScoringInteractionTypes
removeAllQuestionResults($question_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(private \ilObjTest $test, private \ilObjUser $scorer, private \ilDBInterface $db, private readonly TestResultRepository $test_result_repository)
updatePassAndTestResults(array $active_ids)
recalculateQuestionScore(int $user_id, int $active_id, int $pass, array $questiondata)
recalculateSolution(int $active_id, int $pass)
recalculatePass(\ilTestEvaluationPassData $passdata, int $user_id, int $active_id, int $pass)
getPreserveManualScores()
static _updateObjectiveResult(int $a_user_id, int $a_active_id, int $a_question_id)
bool $preserve_manual_scores
setPreserveManualScores(bool $preserve_manual_scores)
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
updateReachedPoints(int $user_id, int $active_id, int $question_id, float $old_points, float $points, float $max_points, int $pass, bool $manual_scoring=false)
This is an optimized version of ::_setReachedPoints that only executes updates in the database if nec...