MDL-66694 forumreport_summary: String update and method tidy up

Replaced 'Char' with full word 'Character' in the charcount string.
Also tidied up show_word_char_counts code and set to protected instead
of private.
This commit is contained in:
Michael Hawkins
2019-10-17 15:05:57 +08:00
parent 74f94dfc26
commit 68f2d677ae
2 changed files with 13 additions and 15 deletions
@@ -687,23 +687,21 @@ class summary_table extends table_sql {
* that they have not been calculated yet.
* @return bool
*/
private function show_word_char_counts(): bool {
protected function show_word_char_counts(): bool {
global $DB;
if (!is_null($this->showwordcharcounts)) {
return $this->showwordcharcounts;
}
if (is_null($this->showwordcharcounts)) {
// This should be really fast.
$sql = "SELECT 'x'
FROM {forum_posts} fp
JOIN {forum_discussions} fd ON fd.id = fp.discussion
WHERE fd.forum = :forumid AND (fp.wordcount IS NULL OR fp.charcount IS NULL)";
// This should be really fast.
$sql = "SELECT 'x'
FROM {forum_posts} fp
JOIN {forum_discussions} fd ON fd.id = fp.discussion
WHERE fd.forum = :forumid AND (fp.wordcount IS NULL OR fp.charcount IS NULL)";
if ($DB->record_exists_sql($sql, ['forumid' => $this->cm->instance])) {
$this->showwordcharcounts = false;
} else {
$this->showwordcharcounts = true;
if ($DB->record_exists_sql($sql, ['forumid' => $this->cm->instance])) {
$this->showwordcharcounts = false;
} else {
$this->showwordcharcounts = true;
}
}
return $this->showwordcharcounts;
@@ -23,7 +23,7 @@
*/
$string['attachmentcount'] = 'Number of attachments';
$string['charcount'] = 'Char count';
$string['charcount'] = 'Character count';
$string['viewcount'] = 'Number of views';
$string['earliestpost'] = 'Earliest post';
$string['filter:groupsbuttonlabel'] = 'Open the groups filter';