mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-57020 scales: Allow deletion of unused scales in forum
Allow deletion of unused scales used in a forum for the course. Signed-off-by: Sujith Haridasan <sujith@moodle.com>
This commit is contained in:
parent
c381757f2a
commit
7b3f43db95
@ -167,5 +167,9 @@ class core_grade_scale_testcase extends grade_base_testcase {
|
||||
$this->assertNotEmpty($grade_item->id);
|
||||
$this->assertEquals(1, $grade_item->grademin);
|
||||
$this->assertEquals(1, $grade_item->grademax);
|
||||
|
||||
$status = $scale->is_used();
|
||||
|
||||
$this->assertTrue($status);
|
||||
}
|
||||
}
|
||||
|
@ -954,7 +954,7 @@ function forum_scale_used_anywhere(int $scaleid): bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $DB->record_exists('forum', ['scale' => $scaleid * -1]);
|
||||
return $DB->record_exists_select('forum', "scale = ? and assessed > 0", [$scaleid * -1]);
|
||||
}
|
||||
|
||||
// SQL FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
|
@ -877,7 +877,7 @@ function glossary_scale_used() {
|
||||
function glossary_scale_used_anywhere($scaleid) {
|
||||
global $DB;
|
||||
|
||||
if ($scaleid and $DB->record_exists('glossary', array('scale'=>-$scaleid))) {
|
||||
if ($scaleid and $DB->record_exists_select('glossary', "scale = ? and assessed > 0", [-$scaleid])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user