In my application, I have some models and the relationship is
- User has Many todaysAssignedRoutePlans.
- todaysAssignedRoutePlans belong to a territory
- The territory has many outlets.
I want to retrieve each user with the number of todaysAssignedRoutePlans and the number of outlets.
So far, I am getting todaysAssignedRoutePlans number, but can’t sum up all outlets for distinct territories for each User…
My code gives outlet count on territorywise. But I want to sum up it userwise…
Your help is highly appreciated.