ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Test\Results\Data\QuestionResult Class Reference
+ Collaboration diagram for ILIAS\Test\Results\Data\QuestionResult:

Public Member Functions

 __construct (private readonly int $id, private readonly string $type, private readonly string $title, private readonly float $question_score, private readonly float $usr_score, private readonly string $usr_solution, private readonly string $best_solution, private readonly string $feedback, private readonly bool $workedthrough, private readonly bool $answered, private readonly int $requested_hints, private readonly ?string $content_for_recapitulation)
 
 getId ()
 
 getType ()
 
 getTitle ()
 
 getUserAnswer ()
 
 getBestSolution ()
 
 getQuestionScore ()
 
 getUserScore ()
 
 getUserScorePercent ()
 
 getCorrect ()
 
 getFeedback ()
 
 isWorkedThrough ()
 
 isAnswered ()
 
 getContentForRecapitulation ()
 
 getNumberOfRequestedHints ()
 

Data Fields

const CORRECT_FULL = 1
 
const CORRECT_PARTIAL = 2
 
const CORRECT_NONE = 3
 

Detailed Description

Definition at line 23 of file QuestionResult.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Results\Data\QuestionResult::__construct ( private readonly int  $id,
private readonly string  $type,
private readonly string  $title,
private readonly float  $question_score,
private readonly float  $usr_score,
private readonly string  $usr_solution,
private readonly string  $best_solution,
private readonly string  $feedback,
private readonly bool  $workedthrough,
private readonly bool  $answered,
private readonly int  $requested_hints,
private readonly ?string  $content_for_recapitulation 
)

Definition at line 29 of file QuestionResult.php.

42  {
43  }

Member Function Documentation

◆ getBestSolution()

ILIAS\Test\Results\Data\QuestionResult::getBestSolution ( )

Definition at line 61 of file QuestionResult.php.

61  : string
62  {
63  return $this->best_solution;
64  }

◆ getContentForRecapitulation()

ILIAS\Test\Results\Data\QuestionResult::getContentForRecapitulation ( )

Definition at line 103 of file QuestionResult.php.

103  : ?string
104  {
105  return $this->content_for_recapitulation;
106  }

◆ getCorrect()

ILIAS\Test\Results\Data\QuestionResult::getCorrect ( )

Definition at line 81 of file QuestionResult.php.

References ILIAS\Test\Results\Data\QuestionResult\getQuestionScore(), and ILIAS\Test\Results\Data\QuestionResult\getUserScore().

81  : int
82  {
83  if ($this->getUserScore() === 0.0) {
84  return self::CORRECT_NONE;
85  }
86  if ($this->getUserScore() === $this->getQuestionScore()) {
87  return self::CORRECT_FULL;
88  }
89  return self::CORRECT_PARTIAL;
90  }
+ Here is the call graph for this function:

◆ getFeedback()

ILIAS\Test\Results\Data\QuestionResult::getFeedback ( )

Definition at line 91 of file QuestionResult.php.

91  : string
92  {
93  return $this->feedback;
94  }

◆ getId()

ILIAS\Test\Results\Data\QuestionResult::getId ( )

Definition at line 45 of file QuestionResult.php.

References $id.

45  : int
46  {
47  return $this->id;
48  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ getNumberOfRequestedHints()

ILIAS\Test\Results\Data\QuestionResult::getNumberOfRequestedHints ( )

Definition at line 107 of file QuestionResult.php.

107  : int
108  {
109  return $this->requested_hints;
110  }

◆ getQuestionScore()

ILIAS\Test\Results\Data\QuestionResult::getQuestionScore ( )

Definition at line 65 of file QuestionResult.php.

Referenced by ILIAS\Test\Results\Presentation\AttemptResultsTable\applyControls(), ILIAS\Test\Results\Data\QuestionResult\getCorrect(), and ILIAS\Test\Results\Data\QuestionResult\getUserScorePercent().

65  : float
66  {
67  return $this->question_score;
68  }
+ Here is the caller graph for this function:

◆ getTitle()

ILIAS\Test\Results\Data\QuestionResult::getTitle ( )

Definition at line 53 of file QuestionResult.php.

53  : string
54  {
55  return $this->title;
56  }

◆ getType()

ILIAS\Test\Results\Data\QuestionResult::getType ( )

Definition at line 49 of file QuestionResult.php.

49  : string
50  {
51  return $this->type;
52  }

◆ getUserAnswer()

ILIAS\Test\Results\Data\QuestionResult::getUserAnswer ( )

Definition at line 57 of file QuestionResult.php.

57  : string
58  {
59  return $this->usr_solution;
60  }

◆ getUserScore()

ILIAS\Test\Results\Data\QuestionResult::getUserScore ( )

Definition at line 69 of file QuestionResult.php.

Referenced by ILIAS\Test\Results\Data\QuestionResult\getCorrect(), and ILIAS\Test\Results\Data\QuestionResult\getUserScorePercent().

69  : float
70  {
71  return $this->usr_score;
72  }
+ Here is the caller graph for this function:

◆ getUserScorePercent()

ILIAS\Test\Results\Data\QuestionResult::getUserScorePercent ( )

Definition at line 73 of file QuestionResult.php.

References ILIAS\Test\Results\Data\QuestionResult\getQuestionScore(), and ILIAS\Test\Results\Data\QuestionResult\getUserScore().

73  : float
74  {
75  if ($this->getQuestionScore() === 0.0) {
76  return 100;
77  }
78 
79  return 100 / $this->getQuestionScore() * $this->getUserScore();
80  }
+ Here is the call graph for this function:

◆ isAnswered()

ILIAS\Test\Results\Data\QuestionResult::isAnswered ( )

Definition at line 99 of file QuestionResult.php.

99  : bool
100  {
101  return $this->answered;
102  }

◆ isWorkedThrough()

ILIAS\Test\Results\Data\QuestionResult::isWorkedThrough ( )

Definition at line 95 of file QuestionResult.php.

95  : bool
96  {
97  return $this->workedthrough;
98  }

Field Documentation

◆ CORRECT_FULL

const ILIAS\Test\Results\Data\QuestionResult::CORRECT_FULL = 1

◆ CORRECT_NONE

const ILIAS\Test\Results\Data\QuestionResult::CORRECT_NONE = 3

◆ CORRECT_PARTIAL

const ILIAS\Test\Results\Data\QuestionResult::CORRECT_PARTIAL = 2

The documentation for this class was generated from the following file: