Fares 10 months ago
parent
commit
d33d2ec862
2 changed files with 8 additions and 4 deletions
  1. 4 3
      lib/handlers/upload_handler.dart
  2. 4 1
      lib/models/data.dart

+ 4 - 3
lib/handlers/upload_handler.dart

@@ -36,6 +36,7 @@ Future<Response> handleFileUpload(Request request) async {
             ?.group(1);
 
         if (name != null && name != "" && filename != null) {
+          print("File Uploaded: $filename");
           try {
             // Create temporary file
             final tempFile = File('uploads/$filename');
@@ -54,7 +55,7 @@ Future<Response> handleFileUpload(Request request) async {
                 );
 
             //insertline in csvhichupdates
-            print("inserting incsvhichupdates");
+            //print("inserting incsvhichupdates");
 
             await supabase.from('csvhichupdates').insert({
               'filename': filename,
@@ -94,14 +95,14 @@ Future<Response> handleFileUpload(Request request) async {
                 "updated_at": now,
               },
             );
-            print("realtime response: $res");
+            //print("realtime response: $res");
 
             //add filename ta list
             uploadedFiles.add({
               'filename': filename,
               'updated_at': now,
             });
-
+            print("...............................................end");
             // Clean up temporary file
             await tempFile.delete();
           } catch (e) {

+ 4 - 1
lib/models/data.dart

@@ -1259,6 +1259,7 @@ processCsvData(File tempfile, SupabaseClient supabase) async {
   }
 
   for (final FilesAsData data in csvData) {
+    print("    |--> processing ${data.filename}");
     //inserting data
     if (tables.keys.contains(data.filename)) {
       final mapsToInsert =
@@ -1324,7 +1325,9 @@ processCsvData(File tempfile, SupabaseClient supabase) async {
       await supabase
           .from(tables[data.filename]!) // Replace with your actual table name
           .insert(mapsToInsert);
-      // print("insert in db ${mapsToInsert.length}");
+
+      print(
+          "         insert: ${mapsToInsert.length} remove: ${indexToRemove.length} maintain: ${indexToMaintain.length}");
       // for (var e in splitList(mapsToInsert, headerToNb(mapsToInsert))) {
       //   await supabase
       //       .from(tables[data.filename]!) // Replace with your actual table name