dev-cmd/contributions: Fix authored vs. committed commit uniqueness
- For a situation where `authored = 3`, `committed = 4`, the previous calculation was `3 - 4` which meant that `committed = -1` in the end. - This was incorrect, since a user can't have negative contributions! - Instead, only do the subtraction to get the deduplicated `committed` count if the number of authored commits is higher than the number of committed commits. This approach should achieve the desired "don't double count things that the user authored and committed, but do count things that another person authored that the user committed".
This commit is contained in:
parent
fcb01e49a2
commit
693d609730
@ -174,9 +174,7 @@ module Homebrew
|
||||
commits_authored = GitHub.repo_commit_count_for_user(repo_full_name, person, "author", args)
|
||||
commits_committed = GitHub.repo_commit_count_for_user(repo_full_name, person, "committer", args)
|
||||
# Only count committers where the author is not the same person. Avoid negative numbers or subtracting zero.
|
||||
if commits_authored.positive? && commits_committed.positive?
|
||||
commits_committed = commits_authored - commits_committed
|
||||
end
|
||||
commits_committed = commits_authored - commits_committed if commits_authored > commits_committed
|
||||
|
||||
data[repo] = {
|
||||
author: commits_authored,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user