diff --git a/backend/src/app/rpc/commands/teams.clj b/backend/src/app/rpc/commands/teams.clj index b77885c059..f4b3e1e27e 100644 --- a/backend/src/app/rpc/commands/teams.clj +++ b/backend/src/app/rpc/commands/teams.clj @@ -192,7 +192,8 @@ (def ^:private sql:get-owned-teams "SELECT t.id, t.name, - (SELECT count(*) FROM team_profile_rel WHERE team_id=t.id) AS total_members + (SELECT count(*) FROM team_profile_rel WHERE team_id=t.id) AS total_members, + (SELECT count(*) FROM team_profile_rel WHERE team_id=t.id AND can_edit=true) AS total_editors FROM team AS t JOIN team_profile_rel AS tpr ON (tpr.team_id = t.id) WHERE t.is_default IS false diff --git a/backend/test/backend_tests/rpc_team_test.clj b/backend/test/backend_tests/rpc_team_test.clj index ddb2e33bbc..60bdb62d6d 100644 --- a/backend/test/backend_tests/rpc_team_test.clj +++ b/backend/test/backend_tests/rpc_team_test.clj @@ -460,11 +460,14 @@ ::rpc/profile-id (:id profile1)} out (th/command! params)] + ;; (th/print-result! out) (t/is (th/success? out)) - (let [result (:result out)] + (let [[item1 :as result] (:result out)] (t/is (= 1 (count result))) - (t/is (= (:id team1) (-> result first :id))) - (t/is (not= (:default-team-id profile1) (-> result first :id)))))) + (t/is (= (:id team1) (:id item1))) + (t/is (= 1 (:total-members item1))) + (t/is (= 1 (:total-editors item1))) + (t/is (not= (:default-team-id profile1) (:id item1)))))) (t/deftest team-deletion-1