Skip to content

Commit

Permalink
remove media_files field, #133 support references
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed May 14, 2024
1 parent 504208d commit 0dfb3a8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions R/ZenodoRecord.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ ZenodoRecord <- R6Class("ZenodoRecord",
id = NULL,
#' @field links list of links associated to the record
links = list(),
#' @field media_files media files
media_files = list(),
#' @field metadata metadata elements associated to the record
metadata = list(),
#' @field parent parent record
Expand Down Expand Up @@ -734,8 +732,8 @@ ZenodoRecord <- R6Class("ZenodoRecord",
addReference = function(reference){
added <- FALSE
if(is.null(self$metadata$references)) self$metadata$references <- list()
if(!(reference %in% self$metadata$references)){
self$metadata$references[[length(self$metadata$references)+1]] <- reference
if(!(reference %in% sapply(self$metadata$references, function(x){x$reference}))){
self$metadata$references[[length(self$metadata$references)+1]] <- list(reference = reference)
added <- TRUE
}
return(added)
Expand All @@ -749,7 +747,7 @@ ZenodoRecord <- R6Class("ZenodoRecord",
if(!is.null(self$metadata$references)){
for(i in 1:length(self$metadata$references)){
ref <- self$metadata$references[[i]]
if(ref == reference){
if(ref$reference == reference){
self$metadata$references[[i]] <- NULL
removed <- TRUE
break;
Expand Down

0 comments on commit 0dfb3a8

Please sign in to comment.