the rivera troops were defeated in both battles