Skip to content

Commit 658f21d

Browse files
authored
fix(tinybird): exclude disabled projects from all pipes (#4313)
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
1 parent 4604ca5 commit 658f21d

11 files changed

Lines changed: 29 additions & 10 deletions

services/libs/tinybird/pipes/activityRepositories_filtered.pipe

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ SQL >
1717
JOIN
1818
repositories r FINAL ON r.insightsProjectId = i.id AND isNull (r.deletedAt) AND r.enabled = true
1919
where
20-
isNull (i.deletedAt)
20+
isNull (i.deletedAt) AND i.enabled = 1
2121
{% if defined(repos) %}
2222
AND r.url
2323
IN {{ Array(repos, 'String', description="Filter activity repo list", required=False) }}

services/libs/tinybird/pipes/collections_filtered.pipe

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,21 @@ SQL >
77
SELECT
88
collections.*,
99
SUM(
10-
CASE WHEN collectionsInsightsProjects.insightsProjectId != '' THEN 1 ELSE 0 END
10+
CASE
11+
WHEN collectionsInsightsProjects.insightsProjectId != '' AND ip.enabled = 1
12+
THEN 1
13+
ELSE 0
14+
END
1115
) as "projectCount"
1216
FROM collections FINAL
1317
left join
1418
collectionsInsightsProjects
1519
on collectionsInsightsProjects.collectionId = collections.id
1620
and isNull (collectionsInsightsProjects.deletedAt)
21+
left join
22+
insightsProjects ip FINAL
23+
on ip.id = collectionsInsightsProjects.insightsProjectId
24+
and isNull (ip.deletedAt)
1725
where
1826
isNull (collections.deletedAt) AND isNull (collections.ssoUserId)
1927
{% if defined(slug) %}

services/libs/tinybird/pipes/contributors_leaderboard.pipe

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ SQL >
4343
FROM insightsProjects final
4444
WHERE
4545
isNull (deletedAt)
46+
AND enabled = 1
4647
and slug = {{ String(project, description="Filter by project slug", required=True) }}
4748

4849
NODE contributors_leaderboard_2

services/libs/tinybird/pipes/health_score_copy.pipe

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ DESCRIPTION >
55
SQL >
66
SELECT id, segmentId, slug, widgets
77
from insightsProjects FINAL
8-
WHERE isNull (deletedAt) and segmentId != ''
8+
WHERE isNull (deletedAt) AND enabled = 1 AND segmentId != ''
99

1010
NODE health_score_copy_data
1111
SQL >

services/libs/tinybird/pipes/health_score_security.pipe

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ SQL >
55
FROM insightsProjects i FINAL
66
JOIN repositories r FINAL ON r.insightsProjectId = i.id
77
WHERE
8-
isNull (i.deletedAt) AND isNull (r.deletedAt) AND r.enabled = true AND r.excluded = false
8+
isNull (i.deletedAt)
9+
AND i.enabled = 1
10+
AND isNull (r.deletedAt)
11+
AND r.enabled = true
12+
AND r.excluded = false
913
{% if defined(project) %}
1014
AND i.id = (SELECT insightsProjectId FROM segments_filtered)
1115
AND r.url in (select arrayJoin(repositories) from segments_filtered)

services/libs/tinybird/pipes/insights_projects_populated_copy.pipe

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ SQL >
268268
last_vulnerability_scan_status
269269
ON last_vulnerability_scan_status.insightsProjectId = insightsProjects.id
270270
LEFT JOIN segments ON segments.id = insightsProjects.segmentId
271-
WHERE isNull (insightsProjects.deletedAt)
271+
WHERE isNull (insightsProjects.deletedAt) AND insightsProjects.enabled = 1
272272
group by 1
273273

274274
TYPE COPY

services/libs/tinybird/pipes/maintainers_roles_copy.pipe

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ SQL >
33
SELECT i.id, r.url AS repository
44
FROM insightsProjects i FINAL
55
JOIN repositories r FINAL ON r.insightsProjectId = i.id
6-
WHERE isNull (i.deletedAt) AND isNull (r.deletedAt) AND r.enabled = true
6+
WHERE isNull (i.deletedAt) AND i.enabled = 1 AND isNull (r.deletedAt) AND r.enabled = true
77

88
NODE maintainers_roles_copy_member_identities_deduplicated
99
SQL >

services/libs/tinybird/pipes/members_public_names_copy_pipe.pipe

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
NODE segmentIds_in_nonlf_projects
22
SQL >
3-
select segmentId from insightsProjects where isLF = 0 and segmentId != '' and isNull (deletedAt)
3+
select segmentId
4+
from insightsProjects
5+
where isLF = 0 and segmentId != '' and isNull (deletedAt) and enabled = 1
46

57
NODE members_public_names_result
68
SQL >

services/libs/tinybird/pipes/repos_to_channels.pipe

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ SQL >
2727
FROM repositories r FINAL
2828
INNER JOIN insightsProjects i FINAL ON r.insightsProjectId = i.id
2929
WHERE
30-
isNull (r.deletedAt) AND r.enabled = true AND isNull (i.deletedAt)
30+
isNull (r.deletedAt) AND r.enabled = true AND isNull (i.deletedAt) AND i.enabled = 1
3131
{% if defined(excluded) and excluded %} AND r.excluded = true
3232
{% end %}
3333
{% end %}
@@ -46,6 +46,7 @@ SQL >
4646
AND isNull (r.deletedAt)
4747
AND r.enabled = true
4848
AND isNull (p.deletedAt)
49+
AND p.enabled = 1
4950
AND r.url IN (SELECT url FROM repos_to_expand)
5051

5152
NODE expanded_urls

services/libs/tinybird/pipes/segments_aggregates_with_ids_copy.pipe

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ NODE segments_aggregates_with_ids_projects
22
SQL >
33
SELECT insightsProjects.id, insightsProjects.segmentId
44
FROM insightsProjects FINAL
5-
WHERE insightsProjects.segmentId != '' and isNull (insightsProjects.deletedAt)
5+
WHERE
6+
insightsProjects.segmentId != ''
7+
AND isNull (insightsProjects.deletedAt)
8+
AND insightsProjects.enabled = 1
69

710
NODE segments_aggregates_with_ids_collections_projects
811
SQL >

0 commit comments

Comments
 (0)