Skip to content

Commit dda1c33

Browse files
authored
feat: badges backend (#3767)
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
1 parent fa8009f commit dda1c33

16 files changed

Lines changed: 32 additions & 16 deletions

services/libs/tinybird/datasources/leaderboards_copy_ds.datasource

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ SCHEMA >
3434
`collectionsSlugs` Array(String),
3535
`isLF` UInt8,
3636
`githubHandle` String,
37-
`status` String
37+
`status` String,
38+
`totalCount` UInt64
3839

3940
ENGINE MergeTree
4041
ENGINE_PARTITION_KEY snapshotId

services/libs/tinybird/pipes/leaderboards.pipe

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ SQL >
2323
collectionsSlugs,
2424
isLF,
2525
githubHandle,
26-
status
26+
status,
27+
totalCount
2728
FROM leaderboards_copy_ds
2829
WHERE
2930
snapshotId = (SELECT max(snapshotId) FROM leaderboards_copy_ds)

services/libs/tinybird/pipes/leaderboards_avg_commits_per_author.pipe

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ SQL >
5050
p.collectionsSlugs as collectionsSlugs,
5151
p.isLF as isLF,
5252
'' as githubHandle,
53-
p.status as status
53+
p.status as status,
54+
count() OVER () as totalCount
5455
FROM leaderboards_avg_commits_per_author_projects p
5556
INNER JOIN leaderboards_avg_commits_per_author_activities c ON p.segmentId = c.segmentId
5657

services/libs/tinybird/pipes/leaderboards_codebase_size.pipe

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ SQL >
4242
p.collectionsSlugs as collectionsSlugs,
4343
p.isLF as isLF,
4444
'' as githubHandle,
45-
p.status as status
45+
p.status as status,
46+
count() OVER () as totalCount
4647
FROM leaderboards_codebase_size_projects p
4748
INNER JOIN leaderboards_codebase_size_activities o ON p.segmentId = o.segmentId
4849
WHERE o.lineDifference > 0

services/libs/tinybird/pipes/leaderboards_commits.pipe

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ SQL >
6161
p.collectionsSlugs as collectionsSlugs,
6262
p.isLF as isLF,
6363
'' as githubHandle,
64-
p.status as status
64+
p.status as status,
65+
count() OVER () as totalCount
6566
FROM leaderboards_commits_projects p
6667
INNER JOIN leaderboards_commits_current_period o ON p.segmentId = o.segmentId
6768
LEFT JOIN leaderboards_commits_previous_period pp ON p.segmentId = pp.segmentId

services/libs/tinybird/pipes/leaderboards_forks.pipe

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ SQL >
4040
p.collectionsSlugs as collectionsSlugs,
4141
p.isLF as isLF,
4242
'' as githubHandle,
43-
p.status as status
43+
p.status as status,
44+
count() OVER () as totalCount
4445
FROM leaderboards_forks_projects p
4546
INNER JOIN leaderboards_forks_metrics m ON p.id = m.id
4647
WHERE m.currentForks > 0

services/libs/tinybird/pipes/leaderboards_issue_response.pipe

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ SQL >
6262
p.collectionsSlugs as collectionsSlugs,
6363
p.isLF as isLF,
6464
'' as githubHandle,
65-
p.status as status
65+
p.status as status,
66+
count() OVER () as totalCount
6667
FROM leaderboards_issue_response_projects p
6768
INNER JOIN leaderboards_issue_response_current_period o ON p.segmentId = o.segmentId
6869
LEFT JOIN leaderboards_issue_response_previous_period pp ON p.segmentId = pp.segmentId

services/libs/tinybird/pipes/leaderboards_members.pipe

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ SQL >
7070
arrayDistinct(arrayFlatten(groupArray(proj.collectionsSlugs))) as collectionsSlugs,
7171
toUInt8(0) as isLF,
7272
p.githubHandle as githubHandle,
73-
'' as status
73+
'' as status,
74+
count() OVER () as totalCount
7475
FROM leaderboards_members_data p
7576
INNER JOIN leaderboards_members_current_period c ON p.id = c.memberId
7677
LEFT JOIN leaderboards_members_previous_period pp ON p.id = pp.memberId ARRAY

services/libs/tinybird/pipes/leaderboards_merge_time.pipe

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ SQL >
5757
p.collectionsSlugs as collectionsSlugs,
5858
p.isLF as isLF,
5959
'' as githubHandle,
60-
p.status as status
60+
p.status as status,
61+
count() OVER () as totalCount
6162
FROM leaderboards_merge_time_projects p
6263
INNER JOIN leaderboards_merge_time_current_period o ON p.segmentId = o.segmentId
6364
LEFT JOIN leaderboards_merge_time_previous_period pp ON p.segmentId = pp.segmentId

services/libs/tinybird/pipes/leaderboards_organizations.pipe

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ SQL >
7575
arrayDistinct(arrayFlatten(groupArray(proj.collectionsSlugs))) as collectionsSlugs,
7676
toUInt8(0) as isLF,
7777
'' as githubHandle,
78-
'' as status
78+
'' as status,
79+
count() OVER () as totalCount
7980
FROM leaderboards_organizations_data p
8081
INNER JOIN leaderboards_organizations_current_period c ON p.id = c.organizationId
8182
LEFT JOIN leaderboards_organizations_previous_period pp ON p.id = pp.organizationId ARRAY

0 commit comments

Comments
 (0)