LLMS_Quiz_Attempt::end( boolean $silent = false )

End a quiz attempt


Description Description

Sets end date, unsets the quiz as the current quiz, and records a grade.


Top ↑

Parameters Parameters

$silent

(boolean) (Optional) If true, will not trigger actions or mark related lesson as complete. Default false.

Default value: false


Top ↑

Return Return

(LLMS_Quiz_Attempt) This quiz attempt instance (for chaining).


Top ↑

Source Source

File: includes/models/model.llms.quiz.attempt.php

	public function end( $silent = false ) {

		$this->set( 'end_date', current_time( 'mysql' ) );
		$this->calculate_grade()->save();

		if ( ! $silent ) {

			$this->do_completion_actions();

		}

		// Clear "cached" grade so it's recalculated next time it's requested.
		$this->get_student()->set( 'overall_grade', '' );

		return $this;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.9.0
3.16.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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