Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing data in get.first.activity.data leads to an error #217

Closed
bockthom opened this issue Dec 2, 2021 · 0 comments
Closed

Missing data in get.first.activity.data leads to an error #217

bockthom opened this issue Dec 2, 2021 · 0 comments

Comments

@bockthom
Copy link
Collaborator

bockthom commented Dec 2, 2021

Description

When getting the first activity data via get.first.activity.data, using multiple activity types (activity.type = c("mails", "commits", "issues")),
we end up in an error when there is no activity for several of these activity types.

In particular, assume that there is no "mail" activity in the range data and no "commit" activity in the range data, but only "issue" activity. In such a case, when reducing activity.by.type, we get an error here:

result = Reduce(function(x, y) {

In this case, both x ("mails") and y ("commits") are empty lists (list()) in the first step of the reduction, making the reduction fail as there are no names in x and y.

Solutions

Quick and dirty solution:

Check if keys is NULL before

result = parallel::mclapply(keys, function(key) {
, and if so, return and empty list instead of combining the values for the keys. Disadvantage: When someone expects that there is a "commits" and "emails" named element in the resulting list for each developer, then this will lead to problems as there is no "commits" or "emails" element in the resulting list.

Preferred solution:

Make sure that the input lists for the reduction (i.e., x and y) are not empty. So, check before the reduction whether multiple lists in activity.by.type are empty, and if there are some, just copy one of the non-empty lists and set all its values to NA. Then reducing the lists should work without any problem and the resulting list in the end should have elements named "commits" and "emails" for each developer though commit data and e-mail data are empty.

Versions

This affects all versions in which the function get.first.activity.data exists.

@bockthom bockthom added the bug label Dec 2, 2021
@bockthom bockthom added this to the v4.1 milestone Dec 2, 2021
nlschn added a commit to nlschn/coronet that referenced this issue Feb 2, 2022
Adresses issue se-sic#217

Signed-off-by: Niklas Schneider <s8nlschn@stud.uni-saarland.de>
nlschn added a commit to nlschn/coronet that referenced this issue Feb 2, 2022
Adresses issue se-sic#217

Signed-off-by: Niklas Schneider <s8nlschn@stud.uni-saarland.de>
nlschn added a commit to nlschn/coronet that referenced this issue Mar 28, 2022
Adresses issue se-sic#217

Signed-off-by: Niklas Schneider <s8nlschn@stud.uni-saarland.de>
@bockthom bockthom mentioned this issue Apr 8, 2022
@bockthom bockthom closed this as completed Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants