diff --git a/mod/assign/submission/onlinetext/locallib.php b/mod/assign/submission/onlinetext/locallib.php index 2a35a9409c1..3fbaeef3155 100644 --- a/mod/assign/submission/onlinetext/locallib.php +++ b/mod/assign/submission/onlinetext/locallib.php @@ -361,16 +361,13 @@ class assign_submission_onlinetext extends assign_submission_plugin { * Display onlinetext word count in the submission status table * * @param stdClass $submission - * @param bool $showviewlink - If the summary has been truncated set this to true + * @param bool $showviewlink - If the summary has been truncated, this should be set to true * @return string */ public function view_summary(stdClass $submission, & $showviewlink) { global $CFG; $onlinetextsubmission = $this->get_onlinetext_submission($submission->id); - // Always show the view link. - $showviewlink = true; - if ($onlinetextsubmission) { // This contains the shortened version of the text plus an optional 'Export to portfolio' button. $text = $this->assignment->render_editor_content(ASSIGNSUBMISSION_ONLINETEXT_FILEAREA, @@ -395,8 +392,10 @@ class assign_submission_onlinetext extends assign_submission_plugin { 'course' => $this->assignment->get_course()->id, 'assignment' => $submission->assignment)); } - // We compare the actual text submission and the shortened version. If they are not equal, we show the word count. - if ($onlinetext != $shorttext) { + + // Compare the actual text submission and the shortened version. If not equal, we show the word count/view more link. + $showviewlink = $onlinetext != $shorttext; + if ($showviewlink) { $wordcount = get_string('numwords', 'assignsubmission_onlinetext', count_words($onlinetext)); return $plagiarismlinks . $wordcount . $text; diff --git a/mod/assign/tests/behat/online_submissions.feature b/mod/assign/tests/behat/online_submissions.feature index 03288613fa7..b5b59ec1ea6 100644 --- a/mod/assign/tests/behat/online_submissions.feature +++ b/mod/assign/tests/behat/online_submissions.feature @@ -37,14 +37,16 @@ Feature: In an assignment, students can add and edit text online | Online text | I'm the student first submission | And I press "Save changes" Then I should see "Submitted for grading" - And I should see "I'm the student first submission" + And "View full" "icon" should not exist in the "Online text" "table_row" + And I should see "I'm the student first submission" in the "Online text" "table_row" And I should see "Not graded" And I press "Edit submission" And I set the following fields to these values: | Online text | I'm the student second submission | And I press "Save changes" Then I should see "Submitted for grading" - And I should see "I'm the student second submission" + And "View full" "icon" should not exist in the "Online text" "table_row" + And I should see "I'm the student second submission" in the "Online text" "table_row" And I should not see "I'm the student first submission" @javascript