Skip to content

Commit

Permalink
#58 additional codes
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Oct 12, 2021
1 parent 0a42cad commit bd31131
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions R/ZenodoManager.R
Original file line number Diff line number Diff line change
Expand Up @@ -594,11 +594,13 @@ ZenodoManager <- R6Class("ZenodoManager",
query <- sprintf("conceptdoi:%s", gsub("/", "//", conceptdoi))
result <- self$getDepositions(q = query, exact = TRUE)
if(length(result)>0){
dois <- vapply(result, function(i) i$doi, character(1))
if (!conceptdoi %in% dois){
conceptdois <- vapply(result, function(i){
i$getConceptDOI()
}, character(1))
if (!conceptdoi %in% conceptdois){
result <- NULL
}else{
result <- result[[which(dois == conceptdoi)[1]]]
result <- result[[which(conceptdois == conceptdoi)[1]]]
self$INFO(sprintf("Successfully fetched record for concept DOI '%s'!", conceptdoi))
}
}else{
Expand Down
2 changes: 1 addition & 1 deletion R/ZenodoRecord.R
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ ZenodoRecord <- R6Class("ZenodoRecord",
doi <- self$metadata$prereserve_doi
if(!is.null(doi)) {
doi_parts <- unlist(strsplit(doi$doi, "zenodo."))
conceptdoi <- paste0(doi_parts[1], "zenodo.", as.integer(doi_parts[2])-1)
conceptdoi <- paste0(doi_parts[1], "zenodo.", self$conceptrecid)
}
}
return(conceptdoi)
Expand Down

0 comments on commit bd31131

Please sign in to comment.