|
1 | 1 | DESCRIPTION > |
2 | 2 | Serves the `Development - Contributions outside work hours` widget |
3 | 3 |
|
4 | | -NODE country_mapping_array |
5 | | -SQL > |
6 | | - SELECT groupArray((country, flag, country_code, timezone_offset)) AS country_data |
7 | | - FROM country_mapping |
8 | | - |
9 | | -NODE members_with_location_information |
10 | | -SQL > |
11 | | - SELECT |
12 | | - m.id, |
13 | | - m.location, |
14 | | - arrayFilter( |
15 | | - x -> position(coalesce(nullIf(upper(m.country), ''), upper(m.location)), upper(x .1)) > 0, |
16 | | - (SELECT country_data FROM country_mapping_array) |
17 | | - ) AS matched_countries, |
18 | | - arrayJoin( |
19 | | - if(empty(matched_countries), [('Unknown', '❓', 'XX', 0)], matched_countries) |
20 | | - ) AS country_data |
21 | | - FROM members_sorted AS m |
22 | | - where country_data .1 != 'Unknown' and m.id in (select memberId from activities_filtered) |
23 | | - |
24 | 4 | NODE activities_with_local_timestamp |
25 | 5 | SQL > |
26 | | - select |
27 | | - count(id) as activityCount, |
28 | | - toDayOfWeek(addHours(af.timestamp, mwli.country_data .4)) as weekday, |
29 | | - intDiv(toHour(addHours(af.timestamp, mwli.country_data .4)), 2) * 2 AS two_hours_block |
30 | | - from activities_filtered af |
31 | | - join members_with_location_information mwli on mwli.id = af.memberId |
32 | | - where platform in ('git', 'github', 'gitlab', 'gerrit') |
| 6 | + % |
| 7 | + select count(id) as activityCount, weekday, two_hours_block |
| 8 | + from contributions_with_local_time_ds a |
| 9 | + where |
| 10 | + segmentId = (SELECT segmentId FROM segments_filtered) |
| 11 | + {% if defined(startDate) %} |
| 12 | + AND a.timestamp |
| 13 | + > {{ DateTime(startDate, description="Filter activity timestamp after", required=False) }} |
| 14 | + {% end %} |
| 15 | + {% if defined(endDate) %} |
| 16 | + AND a.timestamp |
| 17 | + < {{ DateTime(endDate, description="Filter activity timestamp before", required=False) }} |
| 18 | + {% end %} |
| 19 | + {% if defined(repo) %} |
| 20 | + AND a.channel = {{ String(repo, description="Filter activity repo", required=False) }} |
| 21 | + {% end %} |
33 | 22 | group by weekday, two_hours_block |
34 | 23 |
|
35 | 24 | NODE weekday_hours |
|
0 commit comments