You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug][Grafana] Work Log / Code Commits panel error #8833
component/extThis issue or PR relates to external components, such as Grafanaseverity/p1This bug affects functionality or significantly affect uxtype/bugThis issue is a bug
I had searched in the issues 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.
The bug analysis looks correct. The _accounts CTE in the "Code Commits" panel selects u.email from the users table, but the outer query joins on c.author_id = a.email — so when a user's DevLake user email differs from their GitHub account email, the join fails and returns 0 commits [1].
Interestingly, other panels in the same dashboard (e.g., "Lines of code") use c.author_id = a.account_id instead of an email-based join [2], which avoids this issue entirely. The fix proposed here — changing u.email to a.email in the CTE — should resolve the mismatch.
component/extThis issue or PR relates to external components, such as Grafanaseverity/p1This bug affects functionality or significantly affect uxtype/bugThis issue is a bug
Activity
dosubot commentedon Apr 13, 2026
The bug analysis looks correct. The
_accountsCTE in the "Code Commits" panel selectsu.emailfrom theuserstable, but the outer query joins onc.author_id = a.email— so when a user's DevLake user email differs from their GitHub account email, the join fails and returns 0 commits [1].Interestingly, other panels in the same dashboard (e.g., "Lines of code") use
c.author_id = a.account_idinstead of an email-based join [2], which avoids this issue entirely. The fix proposed here — changingu.emailtoa.emailin the CTE — should resolve the mismatch.To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
Merge branch 'main' into fix/apache#8833