LLMS_Quiz_Attempt::calculate_grade()
Calculate and the grade for a completed quiz
Return Return
(LLMS_Quiz_Attempt) Instance of the current quiz attempt.
Source Source
File: includes/models/model.llms.quiz.attempt.php
public function calculate_grade() { $status = 'pending'; if ( $this->is_auto_gradeable() ) { $grade = llms()->grades()->round( $this->get_count( 'earned' ) * $this->calculate_point_weight() ); $quiz = $this->get_quiz(); $min_grade = $quiz ? $quiz->get( 'passing_percent' ) : 100; $this->set( 'grade', $grade ); $status = ( $min_grade <= $grade ) ? 'pass' : 'fail'; } $this->set_status( $status ); return $this; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
4.0.0 | Remove reliance on deprecated method LLMS_Quiz::get_passing_percent() . |
3.9.0 | |
3.24.0 | Introduced. |