MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / _get_integration_counts_by_org

Function _get_integration_counts_by_org

api/platform_hub/services.py:396–412  ·  view source on GitHub ↗

Return a mapping of organisation_id -> total integration count.

(
    org_ids: set[int],
)

Source from the content-addressed store, hash-verified

394
395
396def _get_integration_counts_by_org(
397 org_ids: set[int],
398) -> dict[int, int]:
399 """Return a mapping of organisation_id -> total integration count."""
400 result: dict[int, int] = defaultdict(int)
401 registry = get_integration_registry()
402
403 for model, org_lookup_path, _ in registry.values():
404 counts = (
405 model.objects.filter(**{f"{org_lookup_path}__in": org_ids})
406 .values(**{"org_id": F(org_lookup_path)})
407 .annotate(count=Count("id"))
408 )
409 for row in counts:
410 result[row["org_id"]] += row["count"]
411
412 return result
413
414
415def get_usage_trends(

Callers 1

get_organisation_metricsFunction · 0.85

Calls 1

get_integration_registryFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…