From fdf49de1ca9134a0b5117449bb29bb64f3db572b Mon Sep 17 00:00:00 2001 From: gustav_delius Date: Wed, 13 Apr 2005 08:48:23 +0000 Subject: [PATCH] Fixed the problem reported in bug 2900 that the question count on the category page also counted old questions. --- lang/en/quiz.php | 4 ++-- mod/quiz/category.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lang/en/quiz.php b/lang/en/quiz.php index a97310368aa..fbfdf559063 100644 --- a/lang/en/quiz.php +++ b/lang/en/quiz.php @@ -1,4 +1,4 @@ -name\' contains $a->count questions. Please choose another category to move them to.'; +$string['categorymove'] = 'The category \'$a->name\' contains $a->count questions (some of them may be old, hidden, questions that are still in use in some existing quizzes).
Please choose another category to move them to.'; $string['categorymoveto'] = 'Move them to this category'; $string['categorynoedit'] = 'You do not have editing privileges in the category \'$a\'.'; $string['categoryupdated'] = 'The category was successfully updated'; diff --git a/mod/quiz/category.php b/mod/quiz/category.php index 5c7365d7ae1..953c6822efb 100644 --- a/mod/quiz/category.php +++ b/mod/quiz/category.php @@ -490,7 +490,7 @@ class quiz_category_object { /** -* Arranges the categories into a heirarchical tree +* Arranges the categories into a hierarchical tree * * If a category has children, it's "children" property holds an array of children * The questioncount for each category is also calculated @@ -516,17 +516,17 @@ class quiz_category_object { } $parents = $children; } - // if there is no heirarchy (e.g., if all records have parent == 0), set level[0] to these keys + // if there is no hierarchy (e.g., if all records have parent == 0), set level[0] to these keys if (empty($levels)) { $levels[0] = array_keys($records); } - // build a heirarchical array that depicts the parent-child relationships of the categories + // build a hierarchical array that depicts the parent-child relationships of the categories $categorytree = array(); for ($index = count($levels) - 1; $index >= 0; $index--) { foreach($levels[$index] as $key) { $parentkey = $records[$key]->parent; - if (!($records[$key]->questioncount = count_records('quiz_questions', 'category', $records[$key]->id))) { + if (!($records[$key]->questioncount = count_records('quiz_questions', 'category', $records[$key]->id, 'hidden', 0))) { $records[$key]->questioncount = 0; } if ($parentkey == 0) {