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.
Parameters Parameters
- $silent
-
(boolean) (Optional) If
true, will not trigger actions or mark related lesson as complete. Defaultfalse.Default value: false
Return Return
(LLMS_Quiz_Attempt) This quiz attempt instance (for chaining).
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;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.9.0 | |
| 3.16.0 | Introduced. |