LLMS_Quiz_Attempt::calculate_grade()
Calculate and the grade for a completed quiz
Description Description
Return Return
($this) for chaining
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 |
---|---|
3.9.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: