Skip to content

Commit df4c21f

Browse files
committed
fix: allow including other contributions
Signed-off-by: Raúl Santos <4837+borfast@users.noreply.github.com>
1 parent e6e6922 commit df4c21f

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

services/libs/tinybird/pipes/activityTypes_filtered.pipe

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
DESCRIPTION >
22
- `activityTypes_filtered.pipe` allows filtering activityTypes from the respective data source.
33
- By default, this only returns code contribution activities (`includeCodeContributions = 1`).
4+
- To return all activities, set `includeCodeContributions = 1`, `includeCollaborations = 1`, and `includeOtherContributions = 1`.
45
- Parameters:
56
- `includeCodeContributions`: Optional boolean to include code contribution activities. Defaults to 1. Set to 0 to exclude.
67
- `includeCollaborations`: Optional boolean to include or exclude collaboration activities.
8+
- `includeOtherContributions`: Optional boolean to include other contribution activities (activities that are neither code contributions nor collaborations).
79
- Response: `activityType`, `platform`.
810
- This pipe is used by other downstream pipes as an auxiliary method of filtering data by activity types.
911

@@ -14,8 +16,8 @@ SQL >
1416
FROM activityTypes
1517
WHERE
1618
(
17-
-- If neither parameter is defined, default to including code contributions.
18-
{% if not defined(includeCodeContributions) and not defined(includeCollaborations) %}
19+
-- If no parameters are defined, default to including code contributions.
20+
{% if not defined(includeCodeContributions) and not defined(includeCollaborations) and not defined(includeOtherContributions) %}
1921
isCodeContribution = 1
2022
{% else %}
2123
-- Start with a false literal to safely prepend OR clauses in the next statements,
@@ -43,5 +45,16 @@ SQL >
4345
}} = 1 AND isCollaboration = 1
4446
)
4547
{% end %}
48+
{% if defined(includeOtherContributions) %}
49+
OR (
50+
{{
51+
UInt8(
52+
includeOtherContributions,
53+
description="Include other contribution activities",
54+
required=False,
55+
)
56+
}} = 1 AND isCodeContribution = 0 AND isCollaboration = 0
57+
)
58+
{% end %}
4659
{% end %}
4760
)

0 commit comments

Comments
 (0)