From e84dacffeb021372e6ea7b923c2c821211f475ad Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Tue, 7 Jun 2011 16:56:21 +0100 Subject: [PATCH] MDL-27747 don't truncate essay responses in the reports. #601 --- question/type/essay/question.php | 4 ++-- question/type/essay/simpletest/testquestion.php | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/question/type/essay/question.php b/question/type/essay/question.php index f03ad155e72..3f3c2c4e284 100644 --- a/question/type/essay/question.php +++ b/question/type/essay/question.php @@ -70,8 +70,8 @@ class qtype_essay_question extends question_with_responses { if (isset($response['answer'])) { $formatoptions = new stdClass(); $formatoptions->para = false; - return shorten_text(html_to_text(format_text( - $response['answer'], FORMAT_HTML, $formatoptions), 0, false), 200); + return html_to_text(format_text( + $response['answer'], FORMAT_HTML, $formatoptions), 0, false); } else { return null; } diff --git a/question/type/essay/simpletest/testquestion.php b/question/type/essay/simpletest/testquestion.php index 1b2fe5f552b..bd85d1f0c61 100644 --- a/question/type/essay/simpletest/testquestion.php +++ b/question/type/essay/simpletest/testquestion.php @@ -45,8 +45,7 @@ class qtype_essay_question_test extends UnitTestCase { public function test_summarise_response() { $longstring = str_repeat('0123456789', 50); $essay = test_question_maker::make_an_essay_question(); - $summary = $essay->summarise_response(array('answer' => $longstring)); - $this->assertTrue(strlen($summary) < 250); - $this->assertEqual(substr($longstring, 0, 100), substr($summary, 0, 100)); + $this->assertEqual($longstring, + $essay->summarise_response(array('answer' => $longstring))); } }