LPS-44053 Make countByO_O_P method consistent, so that it generates its SQL properly when default preferences have to be excluded

cc/ @cgoncas