Skip to content

Commit

Permalink
Test: Fix Error on Null Title
Browse files Browse the repository at this point in the history
  • Loading branch information
kergomard committed Jan 15, 2025
1 parent daa81df commit 3287444
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function getEvaluationData(): ilTestEvaluationData
$user_eval_data = new ilTestEvaluationUserData($scoring_settings);

$user_eval_data->setName(
$this->test_obj->buildName($row['usr_id'], $row['firstname'], $row['lastname'], $row['title'])
$this->test_obj->buildName($row['usr_id'], $row['firstname'], $row['lastname'], $row['title'] ?? '')
);

if ($row['login'] !== null) {
Expand Down
14 changes: 9 additions & 5 deletions components/ILIAS/Test/classes/class.ilObjTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2553,19 +2553,23 @@ public function getCompleteEvaluationData($filterby = '', $filtertext = ''): ilT
* @return string The output name of the user
* @access public
*/
public function buildName($user_id, $firstname, $lastname, $title): string
{
public function buildName(
int $user_id,
string $firstname,
string $lastname,
string $title
): string {
$name = "";
if (strlen($firstname . $lastname . $title) == 0) {
if ($firstname . $lastname . $title !== '') {
$name = $this->lng->txt('deleted_user');
} else {
if ($user_id == ANONYMOUS_USER_ID) {
$name = $lastname;
} else {
$name = trim($lastname . ", " . $firstname . " " . $title);
$name = trim($lastname . ', ' . $firstname . ' ' . $title);
}
if ($this->getAnonymity()) {
$name = $this->lng->txt("anonymous");
$name = $this->lng->txt('anonymous');
}
}
return $name;
Expand Down

0 comments on commit 3287444

Please sign in to comment.