From 9d8c26e3af9bd7694465abd000f54217bb6d46da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Grall?= <seinormigr.grall@gmail.com>
Date: Wed, 19 Oct 2022 14:14:18 +0000
Subject: [PATCH 01/11] mod mig env en cours

---
 R/app_server.R   |  6 ++++--
 R/mod_migr_env.R | 28 ++++++++++++++++------------
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/R/app_server.R b/R/app_server.R
index 417d217..2658696 100644
--- a/R/app_server.R
+++ b/R/app_server.R
@@ -55,9 +55,11 @@ app_server <- function(input, output, session) {
   DD$button_ref_parquan_migr_car <- mod_ref_parquan_server("ref_parquan_migr_car", DD, mytab = "migr_car")
 
   # mod_mig_env -----------------------------
-  mod_migr_env_server("migr_env_ui_1")
+  mod_migr_env_server("migr_env_ui_1",DD)
   DD$button_ref_stationmesure_mod_migr_env <- mod_ref_stationmesure_server("ref_stationmesure_mod_migr_env", DD, mytab = "migr_env")
-
+  DD$button_ref_taxa_migr_env <- mod_ref_taxa_server("ref_taxa_mod_migr_env", DD, mytab = "migr_env")
+  DD$button_ref_stage_migr_env <- mod_ref_stage_server("ref_stage_mod_migr_env", DD, mytab = "migr_env")
+  
   # mod_sat_age -----------------------------
   mod_sat_age_server("sat_age_ui_1")
   DD$button_ref_stage_sat_age <- mod_ref_stage_server("ref_stage_sat_age", DD, mytab = "sat_age")
diff --git a/R/mod_migr_env.R b/R/mod_migr_env.R
index 7257b42..bec26c9 100644
--- a/R/mod_migr_env.R
+++ b/R/mod_migr_env.R
@@ -14,9 +14,7 @@ mod_migr_env_ui <- function(id) {
     box(title = "S\u00e9lections :",
       collapsible = TRUE,
       width = 3,
-      selectizeInput("station_mesure_mult", h5("Choisissez une ou plusieurs station(s) de mesure :"),
-        choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
-        multiple = TRUE),
+      mod_ref_stationmesure_ui("ref_stationmesure_mod_migr_env"),
       dateRangeInput("dates", label = h5("S\u00e9lectionnez la date de d\u00e9but et de fin :")),
 
       selectizeInput("pas_temps", h5("Choisissez un pas de temps :"),
@@ -24,12 +22,8 @@ mod_migr_env_ui <- function(id) {
         multiple = FALSE),
       numericInput("num", label = h5("Nombre de pas de temps :"), value = 365),
 
-      selectizeInput("taxon_mult", h5("Choisissez un ou plusieurs taxon(s) :"),
-        choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
-        multiple = TRUE),
-      selectizeInput("stade_mult", h5("Choisissez un ou plusieurs stade(s) :"),
-        choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
-        multiple = TRUE),
+      mod_ref_taxa_ui("ref_taxa_mod_migr_env"),
+      mod_ref_stage_server("ref_stage_mod_migr_env"),
 
       checkboxGroupInput(ns("choix_sorties"), label = h4("Choisissez les sorties graphiques ou tableaux :"),
         choices = list("plot_migr_env1" = 1, "plot_migr_env2" = 2),
@@ -56,9 +50,19 @@ mod_migr_env_ui <- function(id) {
 #' migr_env Server Functions
 #' @importFrom shinipsum random_ggplot
 #' @noRd
-mod_migr_env_server <- function(id) {
+mod_migr_env_server <- function(id,DD,mytab) {
   moduleServer(id, function(input, output, session) {
     ns <- session$ns
+    observeEvent(
+      eventExpr = {
+        DD$button_ref_stationmesure_mod_migr_env()
+      },
+      handlerExpr = {
+        shinyCatch({
+    
+        
+        
+        
     output$plot_migr_env1 <- renderPlot({
       random_ggplot()
     })
@@ -66,9 +70,9 @@ mod_migr_env_server <- function(id) {
     output$plot_migr_env2 <- renderPlot({
       random_ggplot()
     })
-
+        }) ## end shinycatch
   })
-}
+})}
 
 ## To be copied in the UI
 # mod_migr_env_ui("migr_env_ui_1")
-- 
GitLab


From 41c76f90ad8e6141c6628bd0407fd7e7679e7ab8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Grall?= <seinormigr.grall@gmail.com>
Date: Wed, 19 Oct 2022 17:14:49 +0200
Subject: [PATCH 02/11] bug fix

---
 R/mod_migr_env.R | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/R/mod_migr_env.R b/R/mod_migr_env.R
index bec26c9..9ded14a 100644
--- a/R/mod_migr_env.R
+++ b/R/mod_migr_env.R
@@ -23,7 +23,7 @@ mod_migr_env_ui <- function(id) {
       numericInput("num", label = h5("Nombre de pas de temps :"), value = 365),
 
       mod_ref_taxa_ui("ref_taxa_mod_migr_env"),
-      mod_ref_stage_server("ref_stage_mod_migr_env"),
+      mod_ref_stage_ui("ref_stage_mod_migr_env"),
 
       checkboxGroupInput(ns("choix_sorties"), label = h4("Choisissez les sorties graphiques ou tableaux :"),
         choices = list("plot_migr_env1" = 1, "plot_migr_env2" = 2),
-- 
GitLab


From a504bb69fb4b302554b4c5df0b72adf575b7212e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Grall?= <seinormigr.grall@gmail.com>
Date: Wed, 19 Oct 2022 17:39:57 +0200
Subject: [PATCH 03/11] mod migr env en cours

---
 R/mod_annuel.R      | 3 ++-
 R/mod_interannuel.R | 3 ++-
 R/mod_migr_env.R    | 8 +++++++-
 R/mod_ref_stage.R   | 1 +
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/R/mod_annuel.R b/R/mod_annuel.R
index 7810fa4..4459d57 100644
--- a/R/mod_annuel.R
+++ b/R/mod_annuel.R
@@ -22,7 +22,8 @@ mod_annuel_ui <- function(id){
 							label = h5("Choisissez l'ann\u00e9e de d\u00e9but et de fin :"), 
 							min = 1980,
 							max = 	CY, 
-							value = c(2011, 	CY)),
+							value = c(2011, 	CY),
+							sep = ""),
 					mod_ref_taxa_ui("ref_taxa_mod_annuel"),
 					mod_ref_stage_ui("ref_stage_mod_annuel"), 
 					checkboxGroupInput(ns("choix_sorties"), 
diff --git a/R/mod_interannuel.R b/R/mod_interannuel.R
index c521c1f..f17321d 100644
--- a/R/mod_interannuel.R
+++ b/R/mod_interannuel.R
@@ -23,7 +23,8 @@ mod_interannuel_ui <- function(id){
 							label = h5("Choisissez l\'ann\u00e9e"),
 							min = 1980,
 							max = CY, 
-							value = c(2011, CY)),
+							value = c(2011, CY),
+					sep = ""),
 					
 					mod_ref_taxa_ui("ref_taxa_mod_interannuel", multiple=FALSE),
 					mod_ref_stage_ui("ref_stage_mod_interannuel", multiple=FALSE), 
diff --git a/R/mod_migr_env.R b/R/mod_migr_env.R
index 9ded14a..f0af0a5 100644
--- a/R/mod_migr_env.R
+++ b/R/mod_migr_env.R
@@ -56,10 +56,16 @@ mod_migr_env_server <- function(id,DD,mytab) {
     observeEvent(
       eventExpr = {
         DD$button_ref_stationmesure_mod_migr_env()
+        DD$button_ref_taxa_migr_env()
+        DD$button_ref_stage_migr_env()
       },
       handlerExpr = {
         shinyCatch({
-    
+          validate(need(exists("envir_stacomi"), "Le programme stacomi doit être lancé"))
+          db_connection <- envir_stacomi$db_connection
+          validate(need(!is.null(db_connection), "db needs connection"))
+          
+          
         
         
         
diff --git a/R/mod_ref_stage.R b/R/mod_ref_stage.R
index 142bcd9..1e4238a 100644
--- a/R/mod_ref_stage.R
+++ b/R/mod_ref_stage.R
@@ -45,6 +45,7 @@ mod_ref_stage_server <- function(id, DD, mytab) {
       DD$button_ref_taxa_interannuel()
       DD$button_ref_taxa_migr_car()
       DD$button_ref_taxa_sample_char()
+      DD$button_ref_taxa_migr_env()
       DD$tabs()
     },
     handlerExpr = {
-- 
GitLab


From 7268df61107bd2cbf05e525d0b0aa8690d043500 Mon Sep 17 00:00:00 2001
From: Guirec Andre <guirec.andre@ofb.gouv.fr>
Date: Thu, 20 Oct 2022 09:04:38 +0200
Subject: [PATCH 04/11] correct year format to date

---
 R/mod_annuel.R      | 3 ++-
 R/mod_interannuel.R | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/R/mod_annuel.R b/R/mod_annuel.R
index 7810fa4..4459d57 100644
--- a/R/mod_annuel.R
+++ b/R/mod_annuel.R
@@ -22,7 +22,8 @@ mod_annuel_ui <- function(id){
 							label = h5("Choisissez l'ann\u00e9e de d\u00e9but et de fin :"), 
 							min = 1980,
 							max = 	CY, 
-							value = c(2011, 	CY)),
+							value = c(2011, 	CY),
+							sep = ""),
 					mod_ref_taxa_ui("ref_taxa_mod_annuel"),
 					mod_ref_stage_ui("ref_stage_mod_annuel"), 
 					checkboxGroupInput(ns("choix_sorties"), 
diff --git a/R/mod_interannuel.R b/R/mod_interannuel.R
index c521c1f..2bd8a40 100644
--- a/R/mod_interannuel.R
+++ b/R/mod_interannuel.R
@@ -23,7 +23,8 @@ mod_interannuel_ui <- function(id){
 							label = h5("Choisissez l\'ann\u00e9e"),
 							min = 1980,
 							max = CY, 
-							value = c(2011, CY)),
+							value = c(2011, CY),
+							sep = ""),
 					
 					mod_ref_taxa_ui("ref_taxa_mod_interannuel", multiple=FALSE),
 					mod_ref_stage_ui("ref_stage_mod_interannuel", multiple=FALSE), 
-- 
GitLab


From ce3ed655f0655852bacfce71284f901ce0df816f Mon Sep 17 00:00:00 2001
From: Guirec Andre <guirec.andre@ofb.gouv.fr>
Date: Thu, 20 Oct 2022 09:11:57 +0200
Subject: [PATCH 05/11] correction pb merge

---
 R/mod_interannuel.R | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/R/mod_interannuel.R b/R/mod_interannuel.R
index 51a8b67..9f3ed05 100644
--- a/R/mod_interannuel.R
+++ b/R/mod_interannuel.R
@@ -24,11 +24,8 @@ mod_interannuel_ui <- function(id){
 							min = 1980,
 							max = CY, 
 							value = c(2011, CY),
-<<<<<<< HEAD
-							sep = ""),
-=======
-					sep = ""),
->>>>>>> a504bb69fb4b302554b4c5df0b72adf575b7212e
+					    sep = ""),
+
 					
 					mod_ref_taxa_ui("ref_taxa_mod_interannuel", multiple=FALSE),
 					mod_ref_stage_ui("ref_stage_mod_interannuel", multiple=FALSE), 
-- 
GitLab


From f8ad87b9445e74675682a87f286bfaa7990cae11 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Grall?= <seinormigr.grall@gmail.com>
Date: Thu, 20 Oct 2022 11:00:34 +0200
Subject: [PATCH 06/11] issue with plot

---
 R/mod_migr_env.R | 112 +++++++++++++++++++++++++++++++++++++----------
 1 file changed, 89 insertions(+), 23 deletions(-)

diff --git a/R/mod_migr_env.R b/R/mod_migr_env.R
index f0af0a5..8e660f7 100644
--- a/R/mod_migr_env.R
+++ b/R/mod_migr_env.R
@@ -15,12 +15,13 @@ mod_migr_env_ui <- function(id) {
       collapsible = TRUE,
       width = 3,
       mod_ref_stationmesure_ui("ref_stationmesure_mod_migr_env"),
-      dateRangeInput("dates", label = h5("S\u00e9lectionnez la date de d\u00e9but et de fin :")),
-
-      selectizeInput("pas_temps", h5("Choisissez un pas de temps :"),
-        selected = "1 jour", choices = c("1 sec", "1 min", "10 min", "15 min", "30 min", "1 h", "12 h", "1 jour", "1 sem", "2 sem", "1 mois", "3 mois", "6 mois", "1 an"),
-        multiple = FALSE),
-      numericInput("num", label = h5("Nombre de pas de temps :"), value = 365),
+      dateInput(ns("migr_env.datedebut"), label = h5("Choisissez une date de début :"), value = paste0(as.numeric(strftime(Sys.Date(),"%Y"))-1,"-01-01")),
+      dateInput(ns("migr_env.datefin"), label = h5("Choisissez une date de fin :"),  value =paste0(as.numeric(strftime(Sys.Date(),"%Y"))-1,"-12-31")),
+# 
+#       selectizeInput("pas_temps", h5("Choisissez un pas de temps :"),
+#         selected = "1 jour", choices = c("1 sec", "1 min", "10 min", "15 min", "30 min", "1 h", "12 h", "1 jour", "1 sem", "2 sem", "1 mois", "3 mois", "6 mois", "1 an"),
+#         multiple = FALSE),
+#       numericInput("num", label = h5("Nombre de pas de temps :"), value = 365),
 
       mod_ref_taxa_ui("ref_taxa_mod_migr_env"),
       mod_ref_stage_ui("ref_stage_mod_migr_env"),
@@ -37,12 +38,31 @@ mod_migr_env_ui <- function(id) {
 
     ),
 
-    box(collapsible = TRUE,
-      width = 9,
-      plotOutput(ns("plot_migr_env1")),
-      plotOutput(ns("plot_migr_env2"))
+  shinydashboardPlus::box(
+  id=ns("box_plot_migr_env_1"),
+  title="Plot env 1",
+  status = "primary",
+  solidHeader = TRUE,
+  collapsible = TRUE,
+  collapsed=TRUE,
+  width=8,
+  plotOutput(ns("plot_migr_env1"),
+             width = "100%",
+             height = "600px")
+),
 
-    )
+shinydashboardPlus::box(
+  id=ns("box_plot_migr_env_2"),
+  title="Plot env 2",
+  status = "primary",
+  solidHeader = TRUE,
+  collapsible = TRUE,
+  collapsed=TRUE,
+  width=8,
+  plotOutput(ns("plot_migr_env2"),
+             width = "100%",
+             height = "600px")
+), 
 
   )
 }
@@ -55,27 +75,73 @@ mod_migr_env_server <- function(id,DD,mytab) {
     ns <- session$ns
     observeEvent(
       eventExpr = {
-        DD$button_ref_stationmesure_mod_migr_env()
-        DD$button_ref_taxa_migr_env()
-        DD$button_ref_stage_migr_env()
+        # DD$button_ref_stationmesure_mod_migr_env()
+        # DD$button_ref_taxa_migr_env()
+        # DD$button_ref_stage_migr_env()
+        input$bttn_migrenv
       },
       handlerExpr = {
         shinyCatch({
           validate(need(exists("envir_stacomi"), "Le programme stacomi doit être lancé"))
           db_connection <- envir_stacomi$db_connection
           validate(need(!is.null(db_connection), "db needs connection"))
+          r_mig_env<-new("report_mig_env")
+          ref_dc <- base::get("ref_dc", envir=envir_stacomi)
+          ref_taxa <- base::get("ref_taxa", envir=envir_stacomi)
+          ref_stage <- base::get("ref_stage", envir=envir_stacomi)
+          isolate(ref_env <- rlang::env_get(envir_stacomi, "ref_env", default = NULL))
+          req(!is.null(ref_env))
+          validate(need(length(ref_env@env_selected) > 0, "Les stations de mesures n'ont pas été sélectionnées"))
+          validate(need(length(ref_dc@dc_selected)>0, "Pas de DC sélectionné"))										
+          validate(need(length(ref_taxa@taxa_selected)>0, "pas de taxon sélectionné"))
+          validate(need(length(ref_stage@stage_selected)>0, "pas de stade sélectionné"))
+        
+          r_mig_env<-choice_c(r_mig_env,
+                              dc=ref_dc@dc_selected,
+                              taxa=ref_taxa@taxa_selected,
+                              stage=ref_stage@stage_selected,
+                              stationMesure=ref_env@env_selected,
+                              datedebut=input$migr_env.datedebut,
+                              datefin=input$migr_env.datefin,
+                              silent=TRUE)	
+          shinybusy::show_modal_spinner(text="please wait") # show the modal window
+          r_mig_env<-charge(r_mig_env) # this is necessary to load operations, DF and DC
+          r_mig_env<-connect(r_mig_env)
+          r_mig_env<-calcule(r_mig_env,silent=TRUE)
+          shinybusy::remove_modal_spinner() # remove it when done
           
           
+          # graphiques et sorties ----------------------
+          if (nrow(r_mig_env@report_env@data) == 0) {
+            warning("no data available_mig_env")
+          } else {
+            if ("1" %in% input$choix_sorties) {
+              if (input$box_plot_migr_env_1$collapsed) shinydashboardPlus::updateBox("box_plot_migr_env_1", action = "toggle")
+              output$plot_migr_env1 <- renderPlot({
+                #stacomiR::plot(r_mig_env, plot.type = "1")
+                random_ggplot()
+              })
+            } else {
+              if (!input$box_plot_migr_env_1$collapsed) shinydashboardPlus::updateBox("box_plot_migr_env_1", action = "toggle")
+            }  # end ifelse "1"
+            if ("2" %in% input$choix_sorties) {
+              if (input$box_plot_migr_env_2$collapsed) shinydashboardPlus::updateBox("box_plot_migr_env_2", action = "toggle")
+              output$plot_migr_env2 <- renderPlot({
+                #stacomiR::plot(r_mig_env, plot.type = "2")
+                random_ggplot()
+              })
+            } else {
+              if (!input$box_plot_migr_env_2$collapsed) shinydashboardPlus::updateBox("box_plot_migr_env_2", action = "toggle")
+            }  # end ifelse "2"
+          }
         
-        
-        
-    output$plot_migr_env1 <- renderPlot({
-      random_ggplot()
-    })
-
-    output$plot_migr_env2 <- renderPlot({
-      random_ggplot()
-    })
+    # output$plot_migr_env1 <- renderPlot({
+    #   random_ggplot()
+    # })
+    # 
+    # output$plot_migr_env2 <- renderPlot({
+    #   random_ggplot()
+    # })
         }) ## end shinycatch
   })
 })}
-- 
GitLab


From e37e8a65eae28eebff5db523cffe7e5ad3c82b04 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Grall?= <seinormigr.grall@gmail.com>
Date: Thu, 20 Oct 2022 14:02:29 +0200
Subject: [PATCH 07/11] deux pour le prix d'une

---
 R/mod_migr_env.R | 61 ++++++++++++++++++------------------------------
 1 file changed, 23 insertions(+), 38 deletions(-)

diff --git a/R/mod_migr_env.R b/R/mod_migr_env.R
index 8e660f7..5d22775 100644
--- a/R/mod_migr_env.R
+++ b/R/mod_migr_env.R
@@ -17,17 +17,11 @@ mod_migr_env_ui <- function(id) {
       mod_ref_stationmesure_ui("ref_stationmesure_mod_migr_env"),
       dateInput(ns("migr_env.datedebut"), label = h5("Choisissez une date de début :"), value = paste0(as.numeric(strftime(Sys.Date(),"%Y"))-1,"-01-01")),
       dateInput(ns("migr_env.datefin"), label = h5("Choisissez une date de fin :"),  value =paste0(as.numeric(strftime(Sys.Date(),"%Y"))-1,"-12-31")),
-# 
-#       selectizeInput("pas_temps", h5("Choisissez un pas de temps :"),
-#         selected = "1 jour", choices = c("1 sec", "1 min", "10 min", "15 min", "30 min", "1 h", "12 h", "1 jour", "1 sem", "2 sem", "1 mois", "3 mois", "6 mois", "1 an"),
-#         multiple = FALSE),
-#       numericInput("num", label = h5("Nombre de pas de temps :"), value = 365),
-
       mod_ref_taxa_ui("ref_taxa_mod_migr_env"),
       mod_ref_stage_ui("ref_stage_mod_migr_env"),
 
       checkboxGroupInput(ns("choix_sorties"), label = h4("Choisissez les sorties graphiques ou tableaux :"),
-        choices = list("plot_migr_env1" = 1, "plot_migr_env2" = 2),
+        choices = list("plot_migr_env" = 1),
         selected = 1),
       actionBttn(
         inputId = ns("bttn_migrenv"),
@@ -35,34 +29,20 @@ mod_migr_env_ui <- function(id) {
         style = "fill",
         color = "primary"
       )
-
     ),
 
   shinydashboardPlus::box(
-  id=ns("box_plot_migr_env_1"),
-  title="Plot env 1",
-  status = "primary",
-  solidHeader = TRUE,
-  collapsible = TRUE,
-  collapsed=TRUE,
-  width=8,
-  plotOutput(ns("plot_migr_env1"),
-             width = "100%",
-             height = "600px")
-),
-
-shinydashboardPlus::box(
-  id=ns("box_plot_migr_env_2"),
-  title="Plot env 2",
+  id=ns("box_plot_migr_env"),
+  title="Plot migr env",
   status = "primary",
   solidHeader = TRUE,
   collapsible = TRUE,
   collapsed=TRUE,
   width=8,
-  plotOutput(ns("plot_migr_env2"),
+  plotOutput(ns("plot_migr_env"),
              width = "100%",
              height = "600px")
-), 
+) 
 
   )
 }
@@ -116,23 +96,28 @@ mod_migr_env_server <- function(id,DD,mytab) {
             warning("no data available_mig_env")
           } else {
             if ("1" %in% input$choix_sorties) {
-              if (input$box_plot_migr_env_1$collapsed) shinydashboardPlus::updateBox("box_plot_migr_env_1", action = "toggle")
-              output$plot_migr_env1 <- renderPlot({
+              if (input$box_plot_migr_env$collapsed) shinydashboardPlus::updateBox("box_plot_migr_env", action = "toggle")
+              output$plot_migr_env <- renderPlot({
                 #stacomiR::plot(r_mig_env, plot.type = "1")
-                random_ggplot()
+                color_dc<-stacomiR::colortable(color = NULL,r_mig_env@report_mig_mult@dc@dc_selected,palette = "Set2",color_function = c("random"))
+                color_dc_vec<-color_dc$color
+                color_dc_vec=setNames(color_dc_vec,color_dc$name)
+                
+                color_sta_mesure<-stacomiR::colortable(color = NULL, r_mig_env@report_env@stationMesure@env_selected,palette = "Set2",color_function = c("random"))
+                color_sta_mesure_vec<-color_sta_mesure$color
+                color_sta_mesure_vec=setNames(color_sta_mesure_vec,color_sta_mesure$name)
+                
+                stacomiR::plot(r_mig_env,
+                     color_station=color_sta_mesure_vec,
+                     color_dc=color_dc_vec
+                )
+                
+                
               })
             } else {
-              if (!input$box_plot_migr_env_1$collapsed) shinydashboardPlus::updateBox("box_plot_migr_env_1", action = "toggle")
+              if (!input$box_plot_migr_env$collapsed) shinydashboardPlus::updateBox("box_plot_migr_env", action = "toggle")
             }  # end ifelse "1"
-            if ("2" %in% input$choix_sorties) {
-              if (input$box_plot_migr_env_2$collapsed) shinydashboardPlus::updateBox("box_plot_migr_env_2", action = "toggle")
-              output$plot_migr_env2 <- renderPlot({
-                #stacomiR::plot(r_mig_env, plot.type = "2")
-                random_ggplot()
-              })
-            } else {
-              if (!input$box_plot_migr_env_2$collapsed) shinydashboardPlus::updateBox("box_plot_migr_env_2", action = "toggle")
-            }  # end ifelse "2"
+            
           }
         
     # output$plot_migr_env1 <- renderPlot({
-- 
GitLab


From 524b16664e23a240c15cb9aa02b7c024f43beee0 Mon Sep 17 00:00:00 2001
From: Guirec Andre <guirec.andre@ofb.gouv.fr>
Date: Thu, 20 Oct 2022 16:24:39 +0200
Subject: [PATCH 08/11] modif mod_mig_env

---
 R/mod_migr_env.R | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/R/mod_migr_env.R b/R/mod_migr_env.R
index 5d22775..0f3fbdc 100644
--- a/R/mod_migr_env.R
+++ b/R/mod_migr_env.R
@@ -92,6 +92,9 @@ mod_migr_env_server <- function(id,DD,mytab) {
           
           
           # graphiques et sorties ----------------------
+          if (nrow(r_mig_env@report_mig_mult@data) == 0) {
+            warning("no data available_mig_mult")
+          } else
           if (nrow(r_mig_env@report_env@data) == 0) {
             warning("no data available_mig_env")
           } else {
-- 
GitLab


From 03cb9a5c54cc35a97c88e19b908a678a6cedca45 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Grall?= <seinormigr.grall@gmail.com>
Date: Thu, 20 Oct 2022 16:24:54 +0200
Subject: [PATCH 09/11] rien de nouveau

---
 R/mod_migr_env.R | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/R/mod_migr_env.R b/R/mod_migr_env.R
index 5d22775..ef6fe2b 100644
--- a/R/mod_migr_env.R
+++ b/R/mod_migr_env.R
@@ -94,11 +94,11 @@ mod_migr_env_server <- function(id,DD,mytab) {
           # graphiques et sorties ----------------------
           if (nrow(r_mig_env@report_env@data) == 0) {
             warning("no data available_mig_env")
-          } else {
+          }
+          else {
             if ("1" %in% input$choix_sorties) {
               if (input$box_plot_migr_env$collapsed) shinydashboardPlus::updateBox("box_plot_migr_env", action = "toggle")
               output$plot_migr_env <- renderPlot({
-                #stacomiR::plot(r_mig_env, plot.type = "1")
                 color_dc<-stacomiR::colortable(color = NULL,r_mig_env@report_mig_mult@dc@dc_selected,palette = "Set2",color_function = c("random"))
                 color_dc_vec<-color_dc$color
                 color_dc_vec=setNames(color_dc_vec,color_dc$name)
-- 
GitLab


From cdceedc36d594f6e5166bb113c9570bb4b30d158 Mon Sep 17 00:00:00 2001
From: cedricbriandgithub <cedric.briand@eptb-vilaine.fr>
Date: Thu, 20 Oct 2022 16:44:10 +0200
Subject: [PATCH 10/11] Changing package loading

---
 DESCRIPTION      | 6 +++---
 R/mod_migr_env.R | 2 +-
 dev/run_dev.R    | 5 ++++-
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index bc69275..2cf640e 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -22,7 +22,7 @@ Imports:
     spsComps,
     pool,
     shinipsum,
-    stacomiR (>= 0.6.0.5),
+    stacomiR (>= 0.6.0.7),
     dplyr,
     rlang,
     shinybusy,
@@ -39,8 +39,8 @@ Language: en-US
 URL: https://forgemia.inra.fr/stacomi/stacoshiny
 BugReports: https://forgemia.inra.fr/stacomi/stacoshiny/issues
 Remotes: 
-    git::git@forgemia.inra.fr:stacomi/stacomirtools.git,
-    git::git@forgemia.inra.fr:stacomi/stacomir.git
+    git::https://forgemia.inra.fr/stacomi/stacomirtools.git,
+    git::https://forgemia.inra.fr/stacomi/stacomir.git
 VignetteBuilder: knitr
 Depends: 
     R (>= 2.10)
diff --git a/R/mod_migr_env.R b/R/mod_migr_env.R
index bec26c9..9ded14a 100644
--- a/R/mod_migr_env.R
+++ b/R/mod_migr_env.R
@@ -23,7 +23,7 @@ mod_migr_env_ui <- function(id) {
       numericInput("num", label = h5("Nombre de pas de temps :"), value = 365),
 
       mod_ref_taxa_ui("ref_taxa_mod_migr_env"),
-      mod_ref_stage_server("ref_stage_mod_migr_env"),
+      mod_ref_stage_ui("ref_stage_mod_migr_env"),
 
       checkboxGroupInput(ns("choix_sorties"), label = h4("Choisissez les sorties graphiques ou tableaux :"),
         choices = list("plot_migr_env1" = 1, "plot_migr_env2" = 2),
diff --git a/dev/run_dev.R b/dev/run_dev.R
index 2714d87..147b3f3 100644
--- a/dev/run_dev.R
+++ b/dev/run_dev.R
@@ -8,7 +8,10 @@ options(golem.app.prod = FALSE) # TRUE = production mode, FALSE = development mo
 rm(list=ls(all.names = TRUE))
 
 # Document and reload your package
-remotes::install_deps()
+remotes::install_deps(upgrade='never')
+# Pour mettre à jour le package stacomiR (décommenter puis choisir stacomiR)
+#remotes::install_deps(upgrade='ask')
+
 golem::document_and_reload()
 
 # these options set the scene before connecting to the database
-- 
GitLab


From 3930090246abc4a74bb1e9d559162b6c9869c3a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Grall?= <seinormigr.grall@gmail.com>
Date: Fri, 21 Oct 2022 09:59:06 +0000
Subject: [PATCH 11/11] issue fixe

---
 R/mod_migr_env.R | 2 +-
 dev/run_dev.R    | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/R/mod_migr_env.R b/R/mod_migr_env.R
index 2ea51f9..ebe5c69 100644
--- a/R/mod_migr_env.R
+++ b/R/mod_migr_env.R
@@ -109,7 +109,7 @@ mod_migr_env_server <- function(id,DD,mytab) {
                 color_sta_mesure<-stacomiR::colortable(color = NULL, r_mig_env@report_env@stationMesure@env_selected,palette = "Set2",color_function = c("random"))
                 color_sta_mesure_vec<-color_sta_mesure$color
                 color_sta_mesure_vec=setNames(color_sta_mesure_vec,color_sta_mesure$name)
-                
+              
                 stacomiR::plot(r_mig_env,
                      color_station=color_sta_mesure_vec,
                      color_dc=color_dc_vec
diff --git a/dev/run_dev.R b/dev/run_dev.R
index 147b3f3..469fd64 100644
--- a/dev/run_dev.R
+++ b/dev/run_dev.R
@@ -9,6 +9,7 @@ rm(list=ls(all.names = TRUE))
 
 # Document and reload your package
 remotes::install_deps(upgrade='never')
+#devtools::load_all(path = "C:/Users/seino/OneDrive - Seine-Normandie Migrateurs/R/Stacoshiny/stacomir/")
 # Pour mettre à jour le package stacomiR (décommenter puis choisir stacomiR)
 #remotes::install_deps(upgrade='ask')
 
-- 
GitLab