Skip to content

48278 - Scoring adjustment crashes with a TypeError when a participant has no pass result - #12028

Open
lorenzgith wants to merge 2 commits into
ILIAS-eLearning:release_10from
lorenzgith:fix/48278-corrections-null-pass
Open

48278 - Scoring adjustment crashes with a TypeError when a participant has no pass result#12028
lorenzgith wants to merge 2 commits into
ILIAS-eLearning:release_10from
lorenzgith:fix/48278-corrections-null-pass

Conversation

@lorenzgith

Copy link
Copy Markdown
Contributor

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

Saving a change in the scoring adjustment of a question aborts with a TypeError:

ilTestEvaluationUserData::addPass(): Argument #1 ($pass_nr) must be of type int, null given,
called in class.ilTestEvaluationFactory.php on line 119

The query behind this data selects FROM tst_active and joins tst_pass_result with a LEFT JOIN, so a participant who has an active id but no pass result produces a row where pass is NULL. getCorrectionsEvaluationData() passes that straight into addPass(int $pass_nr, ...).

The sibling method getEvaluationData() in the same class already guards against exactly this. This adds the same guard, so both methods behave consistently.

Effect: the scoring adjustment is unusable in any test that contains a participant without a finished attempt, which is common right after an exam.

@lorenzgith

Copy link
Copy Markdown
Contributor Author

A note on the second commit: PHP-CS-Fixer failed on this file, but not because of the change itself.

getEvaluationData() already contained if($row['pass'] === null) { without the space after if, which violates PSR-12. Since the fixer checks the whole file, any PR touching it fails. The second commit only adds that one space, so CI can pass.

Happy to drop it into a separate PR if you would rather keep this one strictly to the fix.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants