Skip to content

Commit

Permalink
Lint fixes to insert_feedback_and_prompt method
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusgreen committed Aug 20, 2024
1 parent ca210d2 commit b5aba4e
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions question.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,30 @@ public function grade_response(array $response): array {
$fraction = $contentobject->marks / $this->defaultmark;
$grade = [$fraction, question_state::graded_state_for_fraction($fraction)];
}
$this->insert_feedback_and_prompt($fullaiprompt,$contentobject);
$this->insert_feedback_and_prompt($fullaiprompt, $contentobject);

return $grade;
}
public function insert_feedback_and_prompt($fullaiprompt, $contentobject) :void {
// The -aicontent data is used in question preview. Only needs to happen in preview.
$this->insert_attempt_step_data('-aiprompt', $fullaiprompt);
$this->insert_attempt_step_data('-aicontent', $contentobject->feedback);
/**
* Inserts the AI feedback and prompt into the attempt step data.
*
* This method is used to insert the AI generated prompt and feedback
* into the attempt step data, which is used during question preview.
* It also adds the feedback as a comment in HTML format.
*
* @param string $fullaiprompt The full AI-generated prompt.
* @param object $contentobject An object containing the feedback.
* @return void
*/
public function insert_feedback_and_prompt($fullaiprompt, $contentobject): void {
// The -aicontent data is used in question preview. Only needs to happen in preview.
$this->insert_attempt_step_data('-aiprompt', $fullaiprompt);
$this->insert_attempt_step_data('-aicontent', $contentobject->feedback);

$this->insert_attempt_step_data('-comment', $contentobject->feedback);
$this->insert_attempt_step_data('-commentformat', FORMAT_HTML);
$this->insert_attempt_step_data('-comment', $contentobject->feedback);
$this->insert_attempt_step_data('-commentformat', FORMAT_HTML);
}

/**
* Used by prompttester in the editing form
*
Expand Down

0 comments on commit b5aba4e

Please sign in to comment.