From 5476f43c9aaa9c8beed608a86208ce96c22b4882 Mon Sep 17 00:00:00 2001 From: Sylvain POULAIN Date: Wed, 6 Sep 2023 16:33:25 +0400 Subject: [PATCH 1/4] Update zen4R_deposit_record.R --- inst/actions/zen4R_deposit_record.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/actions/zen4R_deposit_record.R b/inst/actions/zen4R_deposit_record.R index cce07ce0..2f98ace8 100644 --- a/inst/actions/zen4R_deposit_record.R +++ b/inst/actions/zen4R_deposit_record.R @@ -242,7 +242,7 @@ function(action, entity, config){ if(length(accessRights)>0){ accessRight <- accessRights[[1]]$values[[1]] config$logger.info(sprintf("accessRight Value: '%s'", accessRight)) - zenodo_metadata$setAccessRight(accessRight)- + zenodo_metadata$setAccessRight(accessRight) if ("embargoed" %in% accessRight) { config$logger.info(sprintf("Embargoed! Looking for embargoed date...")) # embargoDate <- as.Date(entity$dates[sapply(entity$dates, function(x){tolower(x$key) == "embargo"})][[1]]$values[[1]]) From 7dc1de798d332ecbf94f674bb4ffbf08b9a55278 Mon Sep 17 00:00:00 2001 From: Sylvain POULAIN Date: Wed, 6 Sep 2023 16:39:05 +0400 Subject: [PATCH 2/4] minor as.Date change --- inst/actions/zen4R_deposit_record.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/actions/zen4R_deposit_record.R b/inst/actions/zen4R_deposit_record.R index 2f98ace8..bb02c458 100644 --- a/inst/actions/zen4R_deposit_record.R +++ b/inst/actions/zen4R_deposit_record.R @@ -247,7 +247,7 @@ function(action, entity, config){ config$logger.info(sprintf("Embargoed! Looking for embargoed date...")) # embargoDate <- as.Date(entity$dates[sapply(entity$dates, function(x){tolower(x$key) == "embargo"})][[1]]$values[[1]]) embargoDates <- entity$dates[sapply(entity$dates, function(date){date$key == "embargo"})] - embargoDate <- if(length(embargoDates)>0) embargoDates[[1]]$values[[1]] else config$logger.error(sprintf("Zenodo: 'embargo' not set in entity$dates whereas 'embargoed' is set in entity$rights. Please check your entities !")) + embargoDate <- if(length(embargoDates)>0) as.Date(embargoDates[[1]]$values[[1]]) else config$logger.error(sprintf("Zenodo: 'embargo' not set in entity$dates whereas 'embargoed' is set in entity$rights. Please check your entities !")) zenodo_metadata$setEmbargoDate(embargoDate) } else if ("restricted" %in% accessRight) { From 87f14bf2c0afa123a6894588db613c8f0cfc39de Mon Sep 17 00:00:00 2001 From: Sylvain POULAIN Date: Wed, 6 Sep 2023 16:51:12 +0400 Subject: [PATCH 3/4] Update zen4R_deposit_record.R --- inst/actions/zen4R_deposit_record.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/actions/zen4R_deposit_record.R b/inst/actions/zen4R_deposit_record.R index bb02c458..a0179712 100644 --- a/inst/actions/zen4R_deposit_record.R +++ b/inst/actions/zen4R_deposit_record.R @@ -247,7 +247,7 @@ function(action, entity, config){ config$logger.info(sprintf("Embargoed! Looking for embargoed date...")) # embargoDate <- as.Date(entity$dates[sapply(entity$dates, function(x){tolower(x$key) == "embargo"})][[1]]$values[[1]]) embargoDates <- entity$dates[sapply(entity$dates, function(date){date$key == "embargo"})] - embargoDate <- if(length(embargoDates)>0) as.Date(embargoDates[[1]]$values[[1]]) else config$logger.error(sprintf("Zenodo: 'embargo' not set in entity$dates whereas 'embargoed' is set in entity$rights. Please check your entities !")) + embargoDate <- if(length(embargoDates)>0) embargoDates[[1]]$value else config$logger.error(sprintf("Zenodo: 'embargo' not set in entity$dates whereas 'embargoed' is set in entity$rights. Please check your entities !")) zenodo_metadata$setEmbargoDate(embargoDate) } else if ("restricted" %in% accessRight) { From 157752763b7be1c797ab7c2e555a7e019840aca6 Mon Sep 17 00:00:00 2001 From: Sylvain POULAIN Date: Wed, 6 Sep 2023 16:57:44 +0400 Subject: [PATCH 4/4] Remove previous as.Date for embargo date outside entity$dates --- inst/actions/zen4R_deposit_record.R | 1 - 1 file changed, 1 deletion(-) diff --git a/inst/actions/zen4R_deposit_record.R b/inst/actions/zen4R_deposit_record.R index a0179712..a7e4954e 100644 --- a/inst/actions/zen4R_deposit_record.R +++ b/inst/actions/zen4R_deposit_record.R @@ -245,7 +245,6 @@ function(action, entity, config){ zenodo_metadata$setAccessRight(accessRight) if ("embargoed" %in% accessRight) { config$logger.info(sprintf("Embargoed! Looking for embargoed date...")) - # embargoDate <- as.Date(entity$dates[sapply(entity$dates, function(x){tolower(x$key) == "embargo"})][[1]]$values[[1]]) embargoDates <- entity$dates[sapply(entity$dates, function(date){date$key == "embargo"})] embargoDate <- if(length(embargoDates)>0) embargoDates[[1]]$value else config$logger.error(sprintf("Zenodo: 'embargo' not set in entity$dates whereas 'embargoed' is set in entity$rights. Please check your entities !")) zenodo_metadata$setEmbargoDate(embargoDate)