You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@devlake.apache.org by "Startrekzky (via GitHub)" <gi...@apache.org> on 2023/12/01 13:34:00 UTC

Re: [I] [Refactor]Grafana - Engineering Throughput and Cycle Time] PR review depth and PR size take forever/don't work [incubator-devlake]

Startrekzky commented on issue #6457:
URL: https://github.com/apache/incubator-devlake/issues/6457#issuecomment-1836127572

   Hi @robgutsopedra , can you try out this SQL?
   
   ```
   with _pr_commits_data as(
     SELECT
       DATE_ADD(date(pr.created_date), INTERVAL -MONTH(date(pr.created_date))+1 DAY) as time,
       pr.id as pr_id,
       pr.merge_commit_sha,
       sum(c.additions)+sum(c.deletions) as loc
     FROM 
       pull_requests pr
       left join commits c on pr.merge_commit_sha = c.sha
       join project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' 
     WHERE
       $__timeFilter(pr.created_date)
       pm.project_name in ($project)
     group by 1,2,3
   )
   
   SELECT 
     time,
     sum(loc)/count(distinct pr_id) as 'PR Size'
   FROM _pr_commits_data
   GROUP BY 1
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org