ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
ILIAS\Test\Questions\Properties\PropertyAggregatedResults Class Reference
+ Inheritance diagram for ILIAS\Test\Questions\Properties\PropertyAggregatedResults:
+ Collaboration diagram for ILIAS\Test\Questions\Properties\PropertyAggregatedResults:

Public Member Functions

 __construct (private readonly int $question_id, private readonly int $number_of_answers=0, private readonly float $available_points=0.0, private readonly float $total_achieved_points=0.0,)
 
 getQuestionId ()
 
 getNumberOfAnswers ()
 
 getAveragePoints ()
 
 getPercentageOfPointsAchieved ()
 

Detailed Description

Definition at line 23 of file PropertyAggregatedResults.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Questions\Properties\PropertyAggregatedResults::__construct ( private readonly int  $question_id,
private readonly int  $number_of_answers = 0,
private readonly float  $available_points = 0.0,
private readonly float  $total_achieved_points = 0.0 
)

Definition at line 25 of file PropertyAggregatedResults.php.

30  {
31  }

Member Function Documentation

◆ getAveragePoints()

ILIAS\Test\Questions\Properties\PropertyAggregatedResults::getAveragePoints ( )

Definition at line 43 of file PropertyAggregatedResults.php.

43  : float
44  {
45  if ($this->number_of_answers === 0) {
46  return 0.0;
47  }
48  return $this->total_achieved_points / $this->number_of_answers;
49  }

◆ getNumberOfAnswers()

ILIAS\Test\Questions\Properties\PropertyAggregatedResults::getNumberOfAnswers ( )

Definition at line 38 of file PropertyAggregatedResults.php.

38  : int
39  {
40  return $this->number_of_answers;
41  }

◆ getPercentageOfPointsAchieved()

ILIAS\Test\Questions\Properties\PropertyAggregatedResults::getPercentageOfPointsAchieved ( )

Definition at line 51 of file PropertyAggregatedResults.php.

51  : float
52  {
53  if ($this->number_of_answers === 0.0
54  || $this->available_points === 0.0) {
55  return 0.0;
56  }
57  return ($this->total_achieved_points / ($this->number_of_answers * $this->available_points)) * 100;
58  }

◆ getQuestionId()

ILIAS\Test\Questions\Properties\PropertyAggregatedResults::getQuestionId ( )

Implements ILIAS\Test\Questions\Properties\Property.

Definition at line 33 of file PropertyAggregatedResults.php.

33  : int
34  {
35  return $this->question_id;
36  }

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