robgutsopedra commented on issue #6457:
URL:
https://github.com/apache/incubator-devlake/issues/6457#issuecomment-1836145374
Just need and "AND" in the where clause, and it works perfectly!!
```
with _pr_commits_data as(
SELECT
DATE_ADD(date(pr.created_date), INTERVAL -MONTH(date(pr.created_date))+1
DAY) as time,
[pr.id](http://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) AND
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
```
It worked almost immediately!!
The only query that's still not working fine is PR size. Could I be
over-ambitious and ask for some help on that one?
A million thanks for your help!
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]