Skip to content

48479 - Accepting a further answer in the answer statistic does not rescore participants - #12186

Merged
kergomard merged 1 commit into
ILIAS-eLearning:release_10from
lorenzgith:fix/48479-rescore-correct-question
Oct 9, 2026
Merged

kergomard merged 1 commit into
ILIAS-eLearning:release_10from
lorenzgith:fix/48479-rescore-correct-question

Conversation

@lorenzgith

Copy link
Copy Markdown
Contributor

https://mantis.ilias.de/view.php?id=48479

In "Korrektur der Punkte" → "Antwortstatistik" a teacher accepts a further answer as correct and gives it points. The answer is stored on the question, the screen reports success — but no participant is rescored. The points only appear after re-saving the whole question on the "Frage" tab.

addAnswer() passes the wrong value:

))->recalculateSolutions(true, $question_index);

$question_index is the sub-question index — for a cloze question the gap number — not a question id. Both values are in the modal: ilAnswerFrequencyStatisticTableGUI::buildAddAnswerAction() sets question_id and question_index, and ilAddAnswerFormBuilder declares both as hidden inputs. question_id is simply never read.

This was already wrong before, but invisible. The filter in TestScoring::recalculatePass() used to be:

if ($this->getQuestionId() !== 0 || $this->getQuestionId() === $question_data['id'])

An OR whose first operand is true for every non-zero value, so every question of the pass was recalculated and the points landed anyway. 10.12 replaced it with a proper equality check — correct in itself, but it exposes the caller: a gap index never equals a question id, $question_id is not null, so no branch matches and nothing is recalculated.

Passing the question id fixes it; $question is already in scope two statements above.

Worth noting for triage: this is silent. The teacher gets a success message, the answer really is saved, and only the learners' scores stay behind — in our case noticed after an exam, by comparing results before and after re-saving the question.

Present in release_10 and trunk alike.

addAnswer() passed $question_index - the sub-question index, for a cloze
question the gap - to recalculateSolutions(), which expects a question id.
Until 10.11 the filter in TestScoring was an OR whose first operand was true
for any non-zero value, so everything was recalculated anyway. With the
equality check introduced in 10.12 nothing matches and no participant is
rescored.
@mjansenDatabay mjansenDatabay added bugfix php Pull requests that update Php code labels Oct 9, 2026
@kergomard
kergomard merged commit 64560ea into ILIAS-eLearning:release_10 Oct 9, 2026
3 checks passed
@kergomard

Copy link
Copy Markdown
Contributor

Thank you very much for the PR and the explanation @lorenzgith ! I'm actually glad that we get these knots sorted out. Merged and picked to ILIAS 11 and trunk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants