Skip to content

[Bug][Grafana] Work Log / Code Commits panel error #8833

@mcseemz

Description

@mcseemz

Search before asking

  • 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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions