public function get_name() {
        // Grade scales can be created at site or course context, so set the filter context appropriately.
        $context = empty($this->courseid) ? context_system::instance() : context_course::instance($this->courseid);
        return format_string($this->name, false, ['context' => $context]);
    }