Skip to content
Snippets Groups Projects
Commit c435ea16 authored by Juliette Engelaere-Lefebvre's avatar Juliette Engelaere-Lefebvre
Browse files

bug fix post_data(), la fonction renvoie désormais une erreur si l'un des...

bug fix post_data(), la fonction renvoie désormais une erreur si l'un des champs de la table à poster est de type liste
parent 442d101b
No related branches found
No related tags found
No related merge requests found
Pipeline #58794 passed
...@@ -135,7 +135,7 @@ importer_data <- function(table = NULL, schema = NULL, db = "production", server ...@@ -135,7 +135,7 @@ importer_data <- function(table = NULL, schema = NULL, db = "production", server
# récupérer les autres propriétés initiales du dataset # récupérer les autres propriétés initiales du dataset
if(nrow(def_table) > 0) { if(nrow(def_table) > 0) {
## assign types ## assign types i <- names(data)[2]
for (i in names(data)) { for (i in names(data)) {
att <- defs[defs$nms == i, ] att <- defs[defs$nms == i, ]
if (length(att[, 1]) == 0) { if (length(att[, 1]) == 0) {
......
...@@ -162,6 +162,10 @@ poster_data <- function(data = NULL, ...@@ -162,6 +162,10 @@ poster_data <- function(data = NULL,
types <- unlist(lapply(d, function(x) { types <- unlist(lapply(d, function(x) {
class(x)[1] class(x)[1]
})) }))
# le type liste n'est pas géré :
attempt::stop_if(any(grepl("list", types)), isTRUE(), msg = "Le type 'list' n'est pas g'\u00e9r\u00e9.\nveuillez convertir les champs concern\u00e9 en texte.")
## modular handling of different data type attributes (add new below) ## modular handling of different data type attributes (add new below)
### gerer les attributs temporels ### gerer les attributs temporels
attr2 <- lapply(d[1, ], function(x) { attr2 <- lapply(d[1, ], function(x) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment