LLMS_Quiz_Attempt::calculate_grade()

Calculate and the grade for a completed quiz


Description Description


Return Return

($this) for chaining


Top ↑

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;

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.9.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.





Permalink: