public static function delete_ratings(\context $context, string $component = null,
            string $ratingarea = null, int $itemid = null) {
        global $DB;

        $options = ['contextid' => $context->id];
        if ($component) {
            $options['component'] = $component;
        }
        if ($ratingarea) {
            $options['ratingarea'] = $ratingarea;
        }
        if ($itemid) {
            $options['itemid'] = $itemid;
        }

        $DB->delete_records('rating', $options);
    }