diff --git a/elixir/apps/domain/lib/domain/gateways.ex b/elixir/apps/domain/lib/domain/gateways.ex index bd2c9d2e0..d7fd9d583 100644 --- a/elixir/apps/domain/lib/domain/gateways.ex +++ b/elixir/apps/domain/lib/domain/gateways.ex @@ -23,6 +23,7 @@ defmodule Domain.Gateways do def count_groups_for_account(%Accounts.Account{} = account) do Group.Query.not_deleted() |> Group.Query.by_account_id(account.id) + |> Group.Query.by_managed_by(:account) |> Repo.aggregate(:count) end diff --git a/elixir/apps/domain/test/domain/gateways_test.exs b/elixir/apps/domain/test/domain/gateways_test.exs index 5d3532750..2eafe8da4 100644 --- a/elixir/apps/domain/test/domain/gateways_test.exs +++ b/elixir/apps/domain/test/domain/gateways_test.exs @@ -37,6 +37,11 @@ defmodule Domain.GatewaysTest do assert count_groups_for_account(account) == 0 end + + test "does not count internet site", %{account: account} do + Fixtures.Gateways.create_internet_group(account: account) + assert count_groups_for_account(account) == 0 + end end describe "fetch_group_by_id/3" do