From c435ea16db7005891d6593e75a1a54c5aae23e94 Mon Sep 17 00:00:00 2001
From: Juliette Engelaere-Lefebvre
 <juliette.engelaere@developpement-durable.gouv.fr>
Date: Wed, 29 Sep 2021 18:36:26 +0200
Subject: [PATCH] =?UTF-8?q?bug=20fix=20post=5Fdata(),=20la=20fonction=20re?=
 =?UTF-8?q?nvoie=20d=C3=A9sormais=20une=20erreur=20si=20l'un=20des=20champ?=
 =?UTF-8?q?s=20de=20la=20table=20=C3=A0=20poster=20est=20de=20type=20liste?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 R/get_data.R  | 2 +-
 R/post_data.R | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/R/get_data.R b/R/get_data.R
index d9111fe..9e96022 100644
--- a/R/get_data.R
+++ b/R/get_data.R
@@ -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
   if(nrow(def_table) > 0) {
 
-    ## assign types
+    ## assign types  i <- names(data)[2]
     for (i in names(data)) {
       att <- defs[defs$nms == i, ]
       if (length(att[, 1]) == 0) {
diff --git a/R/post_data.R b/R/post_data.R
index 8f87bc9..96975a8 100644
--- a/R/post_data.R
+++ b/R/post_data.R
@@ -162,6 +162,10 @@ poster_data <- function(data = NULL,
   types <- unlist(lapply(d, function(x) {
     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)
   ### gerer les attributs temporels
   attr2 <- lapply(d[1, ], function(x) {
-- 
GitLab