Skip to content

Commit

Permalink
Exercise: Fix notifications BT#17787
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Oct 28, 2020
1 parent 73e53b6 commit 773350d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main/exercise/exercise_result.php
Expand Up @@ -273,6 +273,12 @@
MessageManager::send_message($currentUserId, $subject, $content);
}

// Subject for notifications
$subject = sprintf(get_lang('WrongAttemptXInCourseX'), $attemptCountToSend, $courseInfo['title']);
if ($exercisePassed) {
$subject = sprintf(get_lang('ExerciseValidationInCourseX'), $courseInfo['title']);
}

$extraFieldData = $exerciseExtraFieldValue->get_values_by_handler_and_field_variable(
$objExercise->iId,
'notifications'
Expand Down Expand Up @@ -362,7 +368,7 @@
$objExercise->iId,
$attempt['content']
);
if ($extraFieldData && isset($extraFieldData['value'])) {
if ($extraFieldData && isset($extraFieldData['value']) && !empty($extraFieldData['value'])) {
$content = $extraFieldData['value'];
}
}
Expand Down

0 comments on commit 773350d

Please sign in to comment.