Refactor media stats calculations to use pre-computed values from the controller, improving performance and reducing redundant queries in views.