MDL-47869 tool_monitor: add ordering to get_rule_by_courseid method