MDL-71189 mod_quiz: Update completion rule descriptions method
Allow for conditions that are not set, consistent with other modules. They will usually always be set in practice, but best to handle it, which also helps with unit testing.
This commit is contained in:
@@ -145,9 +145,9 @@ class custom_completion extends activity_custom_completion {
|
||||
* @return array
|
||||
*/
|
||||
public function get_custom_rule_descriptions(): array {
|
||||
$minattempts = $this->cm->customdata['customcompletionrules']['completionminattempts'];
|
||||
$minattempts = $this->cm->customdata['customcompletionrules']['completionminattempts'] ?? 0;
|
||||
|
||||
$completionpassorattempts = $this->cm->customdata['customcompletionrules']['completionpassorattemptsexhausted'];
|
||||
$completionpassorattempts = $this->cm->customdata['customcompletionrules']['completionpassorattemptsexhausted'] ?? [];
|
||||
if (!empty($completionpassorattempts['completionattemptsexhausted'])) {
|
||||
$passorallattemptslabel = get_string('completiondetail:passorexhaust', 'mod_quiz');
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user