Skip to content

Commit e10de7b

Browse files
authored
feat: project insights updates (#3925)
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
1 parent 25e438e commit e10de7b

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

services/libs/tinybird/pipes/project_insights.pipe

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ DESCRIPTION >
66
- `slugs`: Optional array of project slugs for multi-project query (e.g., ['kubernetes', 'tensorflow'])
77
- `ids`: Optional array of project ids for multi-project query
88
- At least one of `slug`, `slugs`, or `ids` should be provided.
9+
- `isLfx`: Optional integer (1 = LFX, 0 = non-LFX) to filter by LFX project status
10+
- `orderByField`: Optional string specifying sort field, defaults to 'name'
11+
- `orderByDirection`: Optional string ('asc' or 'desc'), defaults to 'asc'
12+
- `pageSize`: Optional integer for result limit, defaults to 10
13+
- `page`: Optional integer for pagination offset calculation, defaults to 0
914
- Response: Project records with all insights metrics including achievements as array of (leaderboardType, rank, totalCount) tuples
1015
TAGS ""Insights, Widget", "Project""
1116

@@ -54,3 +59,29 @@ SQL >
5459
AND id
5560
IN {{ Array(ids, 'String', description="Filter by project id list", required=False) }}
5661
{% end %}
62+
{% if defined(isLfx) %}
63+
AND isLF
64+
= {{
65+
UInt8(
66+
isLfx, description="Filter by LFX project (1 = LFX, 0 = non-LFX)", required=False
67+
)
68+
}}
69+
{% end %}
70+
ORDER BY
71+
{{ column(String(orderByField, "name", description="Order by field.", required=False)) }}
72+
{% if String(
73+
orderByDirection,
74+
'asc',
75+
description="Order by direction. ASC or DESC",
76+
required=False,
77+
) == 'asc' or String(
78+
orderByDirection,
79+
'asc',
80+
description="Order by direction. ASC or DESC",
81+
required=False,
82+
) == 'ASC' %} ASC
83+
{% else %} DESC
84+
{% end %},
85+
name ASC
86+
LIMIT {{ Int32(pageSize, 10) }}
87+
OFFSET {{ Int32(page, 0) * Int32(pageSize, 10) }}

0 commit comments

Comments
 (0)