Fares 10 hónapja
szülő
commit
bb00fd8fd3
1 módosított fájl, 8 hozzáadás és 3 törlés
  1. 8 3
      lib/models/data.dart

+ 8 - 3
lib/models/data.dart

@@ -1327,8 +1327,11 @@ processCsvData(File tempfile, SupabaseClient supabase) async {
 
       // print("Deleting old data scope: ${mapsToInsert.length}");
       final keys2check = idToRemove[data.filename]!;
-      final mawjoudin = oldComparable.fold(<Map<String, dynamic>>{},
-          (t, e) => {...t, extractMapWithKeys(e, keys2check)}).toList();
+      final mawjoudin = oldComparable.fold(<Map<String, dynamic>>[], (t, e) {
+        t.add(extractMapWithKeys(e, keys2check));
+        return t;
+      });
+
       for (int i = 0; i < oldComparable.length; i++) {
         final item = oldComparable[i];
         final index = findIndex(mapsToInsert, item);
@@ -1340,12 +1343,14 @@ processCsvData(File tempfile, SupabaseClient supabase) async {
                 (e) => mapEquals(extractMapWithKeys(item, keys2check), e),
                 orElse: () => {})
             .keys
-            .isEmpty;
+            .isNotEmpty;
         if (index > -1) {
           indexToMaintain.add(i);
           mapsToInsert.removeAt(index);
         } else if (mawjood) {
           indexToRemove.add(i);
+        } else {
+          print("saved item: $item");
         }
       }