Skip to content

Commit 057350e

Browse files
authored
Merge pull request #118 from ropensci-review-tools/gh-user
fix data-gh-user when user has made no comments
2 parents 8230c30 + cec9932 commit 057350e

File tree

3 files changed

+40
-37
lines changed

3 files changed

+40
-37
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: repometrics
22
Title: Metrics for Your Code Repository
3-
Version: 0.1.6.063
3+
Version: 0.1.6.064
44
Authors@R:
55
person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-2172-5265"))

R/data-gh-user.R

+38-35
Original file line numberDiff line numberDiff line change
@@ -686,47 +686,50 @@ gh_user_issue_cmts_internal <- function (login,
686686
issue_comment_counts <-
687687
issue_comment_counts + dat$data$user$issueComments$totalCount
688688

689-
nodes <- dat$data$user$issueComments$nodes
689+
if (issue_comment_counts > 0L) {
690690

691-
created_at <- c (
692-
created_at,
693-
vapply (nodes, function (i) i$createdAt, character (1L))
694-
)
695-
org_repo <- c (
696-
org_repo,
697-
vapply (
698-
nodes,
699-
function (i) i$issue$repository$nameWithOwner,
700-
character (1L)
691+
nodes <- dat$data$user$issueComments$nodes
692+
693+
created_at <- c (
694+
created_at,
695+
vapply (nodes, function (i) i$createdAt, character (1L))
701696
)
702-
)
703-
issue_num <- c (
704-
issue_num,
705-
vapply (
706-
nodes, function (i) i$issue$number,
707-
integer (1L)
697+
org_repo <- c (
698+
org_repo,
699+
vapply (
700+
nodes,
701+
function (i) i$issue$repository$nameWithOwner,
702+
character (1L)
703+
)
708704
)
709-
)
710-
num_comments <- c (
711-
num_comments,
712-
vapply (
713-
nodes,
714-
function (i) i$issue$comments$totalCount,
715-
integer (1L)
705+
issue_num <- c (
706+
issue_num,
707+
vapply (
708+
nodes, function (i) i$issue$number,
709+
integer (1L)
710+
)
716711
)
717-
)
718-
num_participants <- c (
719-
num_participants,
720-
vapply (
721-
nodes,
722-
function (i) i$issue$participants$totalCount,
723-
integer (1L)
712+
num_comments <- c (
713+
num_comments,
714+
vapply (
715+
nodes,
716+
function (i) i$issue$comments$totalCount,
717+
integer (1L)
718+
)
719+
)
720+
num_participants <- c (
721+
num_participants,
722+
vapply (
723+
nodes,
724+
function (i) i$issue$participants$totalCount,
725+
integer (1L)
726+
)
724727
)
725-
)
726728

727-
if (utils::tail (as.POSIXct (created_at), 1) < start_timestamp) {
728-
has_next_page <- FALSE
729-
}
729+
if (utils::tail (as.POSIXct (created_at), 1) < start_timestamp) {
730+
has_next_page <- FALSE
731+
}
732+
} # else will always have has_next_page = FALSE
730733
}
731734

732735
data.frame (

codemeta.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"codeRepository": "https://github.com/ropensci-review-tools/repometrics",
99
"issueTracker": "https://github.com/ropensci-review-tools/repometrics/issues",
1010
"license": "https://spdx.org/licenses/GPL-3.0",
11-
"version": "0.1.6.063",
11+
"version": "0.1.6.064",
1212
"programmingLanguage": {
1313
"@type": "ComputerLanguage",
1414
"name": "R",

0 commit comments

Comments
 (0)