Skip to content

Commit

Permalink
Fix get.author.names.from.data to always return a list of vectors
Browse files Browse the repository at this point in the history
Signed-off by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
  • Loading branch information
Leo-Send committed Jan 9, 2024
1 parent d87d325 commit ddbfe68
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions util-networks-misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,22 @@ get.author.names.from.networks = function(networks, globally = TRUE) {
#' or any combination of them [default: c("commits", "mails", "issues")]
#' @param globally decides if all author names are in one list or in separate for each network [default: TRUE]
#'
#' @return the list of author names
#' @return the list of author names as a list of vectors
get.author.names.from.data = function(data.ranges, data.sources = c("commits", "mails", "issues"), globally = TRUE) {

data.sources = match.arg.or.default(data.sources, several.ok = TRUE)

## for each range, get the authors who have been active on at least one data source in this range
active.authors.list = lapply(data.ranges, function(range.data) {

active.authors = range.data$get.authors.by.data.source(data.sources)

active.authors.names = active.authors[["author.name"]]
active.authors.names = sort(active.authors[["author.name"]])

return(active.authors.names)

})

if (globally) {
## flatten the list of lists to one list of authors
active.authors = unlist(active.authors.list, recursive = FALSE)
Expand All @@ -97,7 +97,8 @@ get.author.names.from.data = function(data.ranges, data.sources = c("commits", "
## remove duplicates and order alphabetically ascending
active.authors = active.authors[!duplicated(active.authors)]
active.authors = sort(active.authors)
return(active.authors)
## return as a list
return(list(active.authors))
} else {
return(active.authors.list)
}
Expand Down

0 comments on commit ddbfe68

Please sign in to comment.