From 230712c3ea1be656a91135542a40664977aaa891 Mon Sep 17 00:00:00 2001
From: Theophile Terraz <theophile.terraz@inrae.fr>
Date: Thu, 16 Jan 2025 15:03:52 +0100
Subject: [PATCH] debug Adis-TS

---
 src/Model/Pollutants/Pollutants.py         | 4 ++--
 src/Model/Results/ResultsAdisTS.py         | 2 +-
 src/Solver/AdisTS.py                       | 5 ++++-
 src/View/BoundaryConditionsAdisTS/Table.py | 2 +-
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/Model/Pollutants/Pollutants.py b/src/Model/Pollutants/Pollutants.py
index 7a5523ad..79f64514 100644
--- a/src/Model/Pollutants/Pollutants.py
+++ b/src/Model/Pollutants/Pollutants.py
@@ -128,7 +128,7 @@ class Pollutants(SQLSubModel):
 
                 if table is not None:
                     for t in table:
-                        new_data = t[1:]
+                        new_data = t[1:-1]
 
                 new_pollutant._data.append(new_data)
 
@@ -182,7 +182,7 @@ class Pollutants(SQLSubModel):
         print("from_data before : ", data)
         try:
             new = [int(data[0])]
-            new += [float(d) for d in data[1:-1]]
+            new += [float(d) for d in data[1:]]
         except Exception as e:
             logger.error(e)
             new = None
diff --git a/src/Model/Results/ResultsAdisTS.py b/src/Model/Results/ResultsAdisTS.py
index b77dfdf9..33035e2f 100644
--- a/src/Model/Results/ResultsAdisTS.py
+++ b/src/Model/Results/ResultsAdisTS.py
@@ -46,7 +46,7 @@ class Results(object):
             el.split("/")[-1][0:-4]
             for el in glob.glob(repertory_results + "/*.bin")
             ]
-        mylist.insert(0, mylist.pop(mylist.index("total_sediment")))
+        self._pollutants_list.insert(0, self._pollutants_list.pop(self._pollutants_list.index("total_sediment")))
 
         self._phys_var_list = ["C", "G", "M", "D", "L", "N", "R"]
 
diff --git a/src/Solver/AdisTS.py b/src/Solver/AdisTS.py
index 1985a68d..e3233388 100644
--- a/src/Solver/AdisTS.py
+++ b/src/Solver/AdisTS.py
@@ -429,7 +429,10 @@ class AdisTSwc(AdisTS):
         list_characteristics = ["type", "diametre", "rho", "porosity",
                                 "cdc_riv", "cdc_cas", "apd", "ac", "bc"]
 
-        if len(list_characteristics) == (len(pol_data[0])-1):
+        print("pol_data:")
+        print(pol_data[0])
+
+        if len(list_characteristics) <= (len(pol_data[0])):
             for i in range(len(list_characteristics)):
                 f.write(f"{list_characteristics[i]} = {pol_data[0][i]}\n")
 
diff --git a/src/View/BoundaryConditionsAdisTS/Table.py b/src/View/BoundaryConditionsAdisTS/Table.py
index 65752fad..5f4f18ca 100644
--- a/src/View/BoundaryConditionsAdisTS/Table.py
+++ b/src/View/BoundaryConditionsAdisTS/Table.py
@@ -207,7 +207,7 @@ class TableModel(PamhyrTableModel):
 
         self._undo.push(
             AddCommand(
-                self._pollutant, self._bc_list, self._lst, row
+                self._pollutant, self._bc_list, row, self._lst
             )
         )
 
-- 
GitLab