mcseemz opened a new issue, #8833:
URL: https://github.com/apache/incubator-devlake/issues/8833

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   invalid number of commits per user in `Code Commits` panel, Work Logs 
dashboard, when user has multiple accounts and his email does not match the one 
in GitHub.
   
   ### What do you expect to happen
   
   original sql
   ```
   with _accounts as (
     select ua.account_id, ua.user_id, u.name, u.email
       from accounts a 
       join user_accounts ua on a.id = ua.account_id
       join users u on ua.user_id = u.id
     where ua.user_id in (${users:singlequote})
   )
   
   SELECT  count(distinct c.sha)
   FROM commits c
   join _accounts a on c.author_id = a.email
   where $__timeFilter(authored_date)
   ```
   
   proper sql 
   ```
   with _accounts as (
     select ua.account_id, ua.user_id, u.name, a.email <------ should be 
account email, not user email
       from accounts a 
       join user_accounts ua on a.id = ua.account_id
       join users u on ua.user_id = u.id
     where ua.user_id in (${users:singlequote})
   )
   
   SELECT  count(distinct c.sha)
   FROM commits c
   join _accounts a on c.author_id = a.email
   where $__timeFilter(authored_date)
   ```
   
   
   ### How to reproduce
   
   create teams and users with user email not equal to his Github email, open 
panel and observe 0 commits.
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   v1.0.3-beta10@99376a8
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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]

Reply via email to