Skip to content

Commit

Permalink
Exercise: Add new generated audio file link in exercise notifications…
Browse files Browse the repository at this point in the history
… - refs BT#21575
  • Loading branch information
christianbeeznest committed May 7, 2024
1 parent b63efa1 commit dcc4415
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
7 changes: 6 additions & 1 deletion public/main/exercise/exercise.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3629,6 +3629,11 @@ public function manage_answer(
$nbrAnswers = 1;
}

$generatedFile = '';
if ($answerType == ORAL_EXPRESSION) {
$generatedFile = ExerciseLib::getOralFeedbackAudio($exeId, $questionId);
}

$user_answer = '';
// Get answer list for matching
$sql = "SELECT iid, answer
Expand Down Expand Up @@ -6143,7 +6148,7 @@ public function manage_answer(
'open_question' => $arrques,
'open_answer' => $arrans,
'answer_type' => $answerType,
'generated_oral_file' => '',
'generated_oral_file' => $generatedFile,
'user_answered' => $userAnsweredQuestion,
'correct_answer_id' => $correctAnswerId,
'answer_destination' => $answerDestination,
Expand Down
4 changes: 2 additions & 2 deletions public/main/exercise/exercise_show.php
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ function getFCK(vals, marksid) {
if (!empty($comnt)) {
echo ExerciseLib::getFeedbackText($comnt);
}
echo ExerciseLib::getOralFeedbackAudio($id, $questionId, $student_id);
echo ExerciseLib::getOralFeedbackAudio($id, $questionId);
echo '</div>';

echo '<div id="'.$name.'" class="row hidden">';
Expand Down Expand Up @@ -672,7 +672,7 @@ function getFCK(vals, marksid) {
if (!empty($comnt)) {
echo '<b>'.get_lang('Feedback').'</b>';
echo ExerciseLib::getFeedbackText($comnt);
echo ExerciseLib::getOralFeedbackAudio($id, $questionId, $student_id);
echo ExerciseLib::getOralFeedbackAudio($id, $questionId);
}
}

Expand Down
13 changes: 3 additions & 10 deletions public/main/inc/lib/exercise.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -4489,8 +4489,7 @@ public static function displayQuestionListByAttempt(
$comnt = Event::get_comments($exeId, $questionId);
$teacherAudio = self::getOralFeedbackAudio(
$exeId,
$questionId,
api_get_user_id()
$questionId
);

if (!empty($comnt) || $teacherAudio) {
Expand Down Expand Up @@ -5112,15 +5111,9 @@ public static function getOralFeedbackForm($attemptId, $questionId)
}

/**
* Get the audio componen for a teacher audio feedback.
*
* @param int $attemptId
* @param int $questionId
* @param int $userId
*
* @return string
* Get the audio component for a teacher audio feedback.
*/
public static function getOralFeedbackAudio($attemptId, $questionId, $userId)
public static function getOralFeedbackAudio(int $attemptId, int $questionId): string
{
/** @var TrackEExercise $tExercise */
$tExercise = Container::getTrackEExerciseRepository()->find($attemptId);
Expand Down

0 comments on commit dcc4415

Please sign in to comment.