refactor(rating): move logic to controller

Based on #810.