From 1e70d93a8366ee9f90ced19757b7f884499a682e Mon Sep 17 00:00:00 2001 From: xxq250 Date: Mon, 11 Mar 2024 09:22:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=96=B0=E8=AE=A1=E7=AE=97=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E6=88=90=E5=91=98=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/organization.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/models/organization.rb b/app/models/organization.rb index 237efbfe..f978611b 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -182,14 +182,6 @@ class Organization < Owner organization_users.count end - def teams_count - teams.count - end - - def organization_users_count - organization_users.count - end - def real_name name = lastname + firstname name = name.blank? ? (nickname.blank? ? login : nickname) : name @@ -217,4 +209,11 @@ class Organization < Owner enabling_cla == true end + def num_users + organization_user_ids = self.organization_users.pluck(:user_id).uniq + project_member_user_ids = self.projects.joins(:members).pluck("members.user_id").uniq + ids = organization_user_ids + project_member_user_ids + ids.uniq.size + end + end