Skip to content

Commit fc1a7d1

Browse files
committed
chore: apply tb fmt to org page projects copy pipe
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
1 parent 84531db commit fc1a7d1

1 file changed

Lines changed: 30 additions & 19 deletions

File tree

services/libs/tinybird/pipes/org_page_projects_copy_pipe.pipe

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,36 +57,47 @@ SQL >
5757
ifNull(m.orgPrsOpened, 0) AS orgPrsOpened,
5858
(
5959
-- Maintainers: 3 pts if org has at least 1 maintainer
60-
CASE WHEN ifNull(m.maintainersCount, 0) >= 1 THEN 3 ELSE 0 END
6160
-- Contributors: % of org contributors vs total
62-
+ CASE
63-
WHEN ifNull(m.contributorCount, 0) = 0 THEN 0
64-
WHEN ifNull(m.orgContributorCount, 0) * 100.0 / m.contributorCount >= 20 THEN 3
65-
WHEN ifNull(m.orgContributorCount, 0) * 100.0 / m.contributorCount >= 5 THEN 2
66-
WHEN ifNull(m.orgContributorCount, 0) * 100.0 / m.contributorCount >= 1 THEN 1
61+
CASE WHEN ifNull(m.maintainersCount, 0) >= 1 THEN 3 ELSE 0 END + CASE
62+
WHEN ifNull(m.contributorCount, 0) = 0
63+
THEN 0
64+
WHEN ifNull(m.orgContributorCount, 0) * 100.0 / m.contributorCount >= 20
65+
THEN 3
66+
WHEN ifNull(m.orgContributorCount, 0) * 100.0 / m.contributorCount >= 5
67+
THEN 2
68+
WHEN ifNull(m.orgContributorCount, 0) * 100.0 / m.contributorCount >= 1
69+
THEN 1
6770
ELSE 0
68-
END
71+
END
6972
-- Commits: % of org commits vs total
7073
+ CASE
71-
WHEN ifNull(m.commits, 0) = 0 THEN 0
72-
WHEN ifNull(m.orgCommits, 0) * 100.0 / m.commits >= 20 THEN 3
73-
WHEN ifNull(m.orgCommits, 0) * 100.0 / m.commits >= 5 THEN 2
74-
WHEN ifNull(m.orgCommits, 0) * 100.0 / m.commits >= 1 THEN 1
74+
WHEN ifNull(m.commits, 0) = 0
75+
THEN 0
76+
WHEN ifNull(m.orgCommits, 0) * 100.0 / m.commits >= 20
77+
THEN 3
78+
WHEN ifNull(m.orgCommits, 0) * 100.0 / m.commits >= 5
79+
THEN 2
80+
WHEN ifNull(m.orgCommits, 0) * 100.0 / m.commits >= 1
81+
THEN 1
7582
ELSE 0
76-
END
83+
END
7784
-- PRs opened: % of org PRs vs total
7885
+ CASE
79-
WHEN ifNull(m.prsOpened, 0) = 0 THEN 0
80-
WHEN ifNull(m.orgPrsOpened, 0) * 100.0 / m.prsOpened >= 20 THEN 3
81-
WHEN ifNull(m.orgPrsOpened, 0) * 100.0 / m.prsOpened >= 5 THEN 2
82-
WHEN ifNull(m.orgPrsOpened, 0) * 100.0 / m.prsOpened >= 1 THEN 1
86+
WHEN ifNull(m.prsOpened, 0) = 0
87+
THEN 0
88+
WHEN ifNull(m.orgPrsOpened, 0) * 100.0 / m.prsOpened >= 20
89+
THEN 3
90+
WHEN ifNull(m.orgPrsOpened, 0) * 100.0 / m.prsOpened >= 5
91+
THEN 2
92+
WHEN ifNull(m.orgPrsOpened, 0) * 100.0 / m.prsOpened >= 1
93+
THEN 1
8394
ELSE 0
84-
END
95+
END
8596
) AS technicalScore,
8697
w.computedAt
8798
FROM org_page_projects_with_meta w
88-
LEFT JOIN org_dash_metric_copy_ds m
89-
ON w.organizationId = m.organizationId AND w.projectSlug = m.slug
99+
LEFT JOIN
100+
org_dash_metric_copy_ds m ON w.organizationId = m.organizationId AND w.projectSlug = m.slug
90101

91102
TYPE COPY
92103
TARGET_DATASOURCE org_page_projects_copy_ds

0 commit comments

Comments
 (0)