VSD: Number of distinct/unique contributors
Problem
We currently don't have a performant way to compute the number of distinct / unique contributors.
Solution
Use the data currently in CH to expose this data via graphql. We want to replicate the logic used for the contributions heatmap. In this issue we will create a new table for the contribution count by adding the material view schema and and the DB query.
Exposing the data via graphql will be handled in VSD: Number of distinct/unique contributors - e... (#432838 - closed)
Implementation steps:
Introduce a new materialized view with the same schema like the db/click_house/migrate/20230724064832_create_contribution_analytics_events.rb
and db/click_house/migrate/20230724064918_create_contribution_analytics_events_materialized_view.rb
migrations where we use a different query condition.
The query for the materialized view would be slightly different, see the current calendar query condition (PG query):
(
action IN (5,6)
OR
(target_type IN ('MergeRequest','Issue','WorkItem') AND action IN (1,3,7,12))
)
Two differences:
- We have a new action: 6
- target_type includes
WorkItem
The condition is very similar to the current CA table, so at some point we might be able to combine the two tables. (remove the old contribution_analytics_events
table and use the new table).
The new table name: contributions