Created popularity algorthim logic in controller to display in view