Changed: Move post rating calculation into separate queries for better reuse.