Organization - create finder to calculate group, project, and user counts
Related to !130230 (comment 1532742206) and !130017 (comment 1531460771)
On the front page of organizations we will show group, project and user counts. We need a way to calculate these counts and they should only be shown to organization owners. It was suggested in !130230 (comment 1534729458) that we create a finder to calculate these association counts.
As of now the association counts on the front page are hardcoded mock data and are shown to all users. We will need to make some small frontend changes to show real data and only to owners.
Engineering guide
1
Frontend - weight of - Update association counts to use real data in app/helpers/organizations/organization_helper.rb#L10
- Add owner ability to app/helpers/organizations/organization_helper.rb#L6. Depends on what we name the ability. It could be
:admin_organization
or something similar. - Check ability in app/assets/javascripts/organizations/show/components/app.vue#L29
Backend
- Groups count:
organization.groups.count
(namespaces
has anorganization_id
foreign key) - Projects count:
organization.projects.count
(namespaces
has anorganization_id
foreign key) - Users count:
organization.users.count)
. Note that the records that end up in theorganization_users
table are still a bit loosely defined, but this should not impact the finder in this case.
Edited by Alex Pooley