Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions services/libs/tinybird/datasources/organizations.datasource
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DESCRIPTION >
- `employees` is the number of employees in the organization (0 default if unknown).
- `createdAt` and `updatedAt` are standard timestamp fields for record lifecycle tracking.
- `isTeamOrganization` flag indicates whether this organization is part of the project team (UInt8 boolean, 0 default).
- `isAffiliationBlocked` flag indicates the organization is blocked from affiliations and must not get an Insights page (UInt8 boolean, 0 default).
- `type` specifies the organization type (company, nonprofit, government, etc., empty string if not specified).
- `size` describes the organization size category: "1-10", "501-1000", "1001-5000", "5001-10000", "10001+" (empty string if not specified).
- `headline` is a brief description or tagline for the organization (empty string if not provided).
Expand All @@ -28,6 +29,7 @@ SCHEMA >
`createdAt` DateTime64(3) `json:$.record.createdAt`,
`updatedAt` DateTime64(3) `json:$.record.updatedAt`,
`isTeamOrganization` UInt8 `json:$.record.isTeamOrganization` DEFAULT 0,
`isAffiliationBlocked` UInt8 `json:$.record.isAffiliationBlocked` DEFAULT 0,
Comment thread
gaspergrom marked this conversation as resolved.
`type` String `json:$.record.type` DEFAULT '',
`size` String `json:$.record.size` DEFAULT '',
`headline` String `json:$.record.headline` DEFAULT '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ SCHEMA >
`createdAt` DateTime64(3),
`updatedAt` DateTime64(3),
`isTeamOrganization` UInt8 DEFAULT 0,
`isAffiliationBlocked` UInt8 DEFAULT 0,
`type` String DEFAULT '',
`size` String DEFAULT '',
`headline` String DEFAULT '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DESCRIPTION >
Retrieves all organizations from the populated datasource, including slug for page links

SQL >
SELECT o.id, o.displayName, o.logo, ops.slug
SELECT o.id, o.displayName, o.logo, if(o.isAffiliationBlocked = 1, '', ops.slug) AS slug
FROM organizations o FINAL
LEFT JOIN organizations_populated_slug ops ON o.id = ops.id

Expand Down
2 changes: 2 additions & 0 deletions services/libs/tinybird/pipes/org_dash_activities_count.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ SQL >
required=True,
)
}}
AND organizationId
NOT IN (SELECT id FROM organizations FINAL WHERE isAffiliationBlocked = 1)
) as "orgActivityCount"
FROM generate_timeseries ds
LEFT JOIN
Expand Down
2 changes: 2 additions & 0 deletions services/libs/tinybird/pipes/org_dash_avg_merge_time.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ SQL >
required=True,
)
}}
AND organizationId
NOT IN (SELECT id FROM organizations FINAL WHERE isAffiliationBlocked = 1)
)
) as "orgAverageMergeTimeSeconds"
FROM generate_timeseries ds
Expand Down
2 changes: 2 additions & 0 deletions services/libs/tinybird/pipes/org_dash_contributors.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ SQL >
required=True,
)
}}
AND organizationId
NOT IN (SELECT id FROM organizations FINAL WHERE isAffiliationBlocked = 1)
) as "orgContributorCount"
FROM generate_timeseries ds
LEFT JOIN
Expand Down
2 changes: 2 additions & 0 deletions services/libs/tinybird/pipes/org_dash_maintainers.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ SQL >
required=True,
)
}}
AND m.organizationId
NOT IN (SELECT id FROM organizations FINAL WHERE isAffiliationBlocked = 1)
) as "orgMaintainersCount"
FROM generate_timeseries ds
CROSS JOIN org_dash_maintainers_roles_filtered m
Expand Down
1 change: 1 addition & 0 deletions services/libs/tinybird/pipes/org_dash_metrics.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ SQL >
FROM org_dash_metric_copy_ds
WHERE
1 = 1
AND organizationId NOT IN (SELECT id FROM organizations FINAL WHERE isAffiliationBlocked = 1)
Comment thread
gaspergrom marked this conversation as resolved.
{% if defined(organizationIds) %}
AND organizationId
in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ SQL >
%
SELECT id
FROM organizations_populated_slug
WHERE slug = {{ String(orgSlug, '', description="Organization slug", required=True) }}
WHERE
slug = {{ String(orgSlug, '', description="Organization slug", required=True) }}
AND isAffiliationBlocked = 0

NODE org_page_activities_timeseries_data
SQL >
Expand Down
4 changes: 3 additions & 1 deletion services/libs/tinybird/pipes/org_page_contributors.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ SQL >
%
SELECT id
FROM organizations_populated_slug
WHERE slug = {{ String(orgSlug, '', description="Organization slug", required=True) }}
WHERE
slug = {{ String(orgSlug, '', description="Organization slug", required=True) }}
AND isAffiliationBlocked = 0

NODE org_page_contributors_activity_aggregates
SQL >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ SQL >
%
SELECT id
FROM organizations_populated_slug
WHERE slug = {{ String(orgSlug, '', description="Organization slug", required=True) }}
WHERE
slug = {{ String(orgSlug, '', description="Organization slug", required=True) }}
AND isAffiliationBlocked = 0

NODE org_page_contributors_timeseries_data
SQL >
Expand Down
4 changes: 3 additions & 1 deletion services/libs/tinybird/pipes/org_page_kpis.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ SQL >
%
SELECT id
FROM organizations_populated_slug
WHERE slug = {{ String(orgSlug, '', description="Organization slug", required=True) }}
WHERE
slug = {{ String(orgSlug, '', description="Organization slug", required=True) }}
AND isAffiliationBlocked = 0

NODE org_page_kpis_main
SQL >
Expand Down
4 changes: 3 additions & 1 deletion services/libs/tinybird/pipes/org_page_profile.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ SQL >
%
SELECT id
FROM organizations_populated_slug
WHERE slug = {{ String(orgSlug, '', description="Organization slug", required=True) }}
WHERE
slug = {{ String(orgSlug, '', description="Organization slug", required=True) }}
AND isAffiliationBlocked = 0

NODE org_page_profile_base
SQL >
Expand Down
4 changes: 3 additions & 1 deletion services/libs/tinybird/pipes/org_page_projects.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ SQL >
%
SELECT id
FROM organizations_populated_slug
WHERE slug = {{ String(orgSlug, '', description="Organization slug", required=True) }}
WHERE
slug = {{ String(orgSlug, '', description="Organization slug", required=True) }}
AND isAffiliationBlocked = 0

NODE org_page_projects_main
SQL >
Expand Down
2 changes: 1 addition & 1 deletion services/libs/tinybird/pipes/organizations_filtered.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SQL >
organizations_code_contributors
ON organizations_populated_slug.id = organizations_code_contributors.organizationId
where
1 = 1
1 = 1 AND organizations_populated_slug.isAffiliationBlocked = 0
{% if defined(slug) %}
AND organizations_populated_slug.slug
= {{ String(slug, description="Filter organization by slug", required=False) }}
Expand Down
6 changes: 3 additions & 3 deletions services/libs/tinybird/pipes/organizations_leaderboard.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ DESCRIPTION >
- `offset`: Optional integer for result pagination, defaults to 0
- Response:
- Count mode (`count=true`): `count` (total number of organizations)
- Data mode (default): `id`, `slug`, `logo`, `displayName`, `contributionCount`, `contributionPercentage`
- Data mode (default): `id`, `slug` (empty string for affiliation-blocked organizations), `logo`, `displayName`, `contributionCount`, `contributionPercentage`

NODE organizations_leaderboard_paginated
SQL >
Expand All @@ -28,14 +28,14 @@ SQL >
{% else %}
SELECT
org.id AS id,
org.slug AS slug,
if(org.isAffiliationBlocked = 1, '', org.slug) AS slug,
org.logo AS logo,
org.displayName AS displayName,
COUNT(af.id) AS contributionCount,
ROUND(COUNT(af.id) * 100.0 / SUM(COUNT(af.id)) OVER (), 2) AS contributionPercentage
FROM activities_filtered af
JOIN organizations_populated_slug org ON org.id = af.organizationId
GROUP BY org.id, org.slug, org.logo, org.displayName
GROUP BY org.id, org.slug, org.isAffiliationBlocked, org.logo, org.displayName
ORDER BY contributionCount DESC, id desc
LIMIT {{ Int32(limit, 10) }}
OFFSET {{ Int32(offset, 0) }}
Expand Down
4 changes: 4 additions & 0 deletions services/libs/tinybird/pipes/organizations_populate_slug.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ SQL >
org.createdAt AS createdAt,
org.updatedAt AS updatedAt,
org.isTeamOrganization AS isTeamOrganization,
org.isAffiliationBlocked AS isAffiliationBlocked,
org.type AS type,
org.size AS size,
org.headline AS headline,
Expand Down Expand Up @@ -56,6 +57,7 @@ SQL >
createdAt,
updatedAt,
isTeamOrganization,
isAffiliationBlocked,
type,
size,
headline,
Expand Down Expand Up @@ -84,6 +86,7 @@ SQL >
createdAt,
updatedAt,
isTeamOrganization,
isAffiliationBlocked,
type,
size,
headline,
Expand All @@ -103,6 +106,7 @@ SQL >
createdAt,
updatedAt,
isTeamOrganization,
isAffiliationBlocked,
type,
size,
headline,
Expand Down
Loading