Marino Faggiana 8 жил өмнө
parent
commit
e421970c96

+ 2 - 2
iOSClient/Favorites/CCSynchronize.m

@@ -112,7 +112,7 @@
         // Delete Record NOT in session
         //[CCCoreData deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND (directoryID == %@) AND (fileID = %@) AND ((session == NULL) OR (session == ''))", app.activeAccount, metadata.directoryID, metadata.fileID]];
         
-        [[NCManageDatabase sharedInstance] deleteMetadata:[NSPredicate predicateWithFormat:@"(account == %@) AND (directoryID == %@) AND (fileID = %@) AND ((session == NULL) OR (session == ''))", app.activeAccount, metadata.directoryID, metadata.fileID]];
+        [[NCManageDatabase sharedInstance] deleteMetadata:[NSPredicate predicateWithFormat:@"(account = %@) AND (directoryID = %@) AND (fileID = %@) AND (session = '')", app.activeAccount, metadata.directoryID, metadata.fileID]];
         
         // end test, insert in CoreData
         [[NCManageDatabase sharedInstance] addMetadata:metadata activeUrl:app.activeUrl];
@@ -282,7 +282,7 @@
         
         //NSArray *tableMetadatas = [CCCoreData getTableMetadataWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND (directoryID == %@) AND ((session == NULL) OR (session == ''))", app.activeAccount, metadataNet.directoryID] context:nil];
         
-        NSArray *tableMetadatas = [[NCManageDatabase sharedInstance] getMetadatasWithPreficate:[NSPredicate predicateWithFormat:@"(account == %@) AND (directoryID == %@) AND ((session == NULL) OR (session == ''))", app.activeAccount, metadataNet.directoryID] sorted:nil ascending:NO];
+        NSArray *tableMetadatas = [[NCManageDatabase sharedInstance] getMetadatasWithPreficate:[NSPredicate predicateWithFormat:@"(account = %@) AND (directoryID = %@) AND (session = '')", app.activeAccount, metadataNet.directoryID] sorted:nil ascending:NO];
         
         for (TableMetadata *record in tableMetadatas) {
             

+ 15 - 1
iOSClient/FileSystem/NCManageDatabase.swift

@@ -1361,7 +1361,21 @@ class NCManageDatabase: NSObject {
         
         let realm = try! Realm()
         
-        let predicate = NSPredicate(format: "(account == %@) AND (serverUrl == %@) AND ((session == NULL) OR (session == '')) AND (type == 'file') AND ((typeFile == %@) OR (typeFile == %@))", tableAccount!.account, serverUrl, k_metadataTypeFile_image, k_metadataTypeFile_video)
+        /*
+        var recordsPhotosCameraUpload = [tableMetadata]()
+        let tableDirectoryes = CCCoreData.getDirectoryIDsFromBegins(withServerUrl: serverUrl, activeAccount: tableAccount!.account)
+        
+        for result in tableDirectoryes! {
+            
+            
+        
+        }
+        */
+        
+        let directoryID = CCCoreData.getDirectoryID(fromServerUrl: serverUrl, activeAccount: tableAccount!.account)
+        
+        
+        let predicate = NSPredicate(format: "(account == %@) AND (directoryID == %@) AND (session == '')AND (type == 'file') AND ((typeFile == %@) OR (typeFile == %@))", tableAccount!.account, directoryID!, k_metadataTypeFile_image, k_metadataTypeFile_video)
         
         let sorted = CCUtility.getOrderSettings()
         let ascending = CCUtility.getAscendingSettings()

+ 4 - 4
iOSClient/Main/CCMain.m

@@ -1599,7 +1599,7 @@
 {
     //NSArray *records = [CCCoreData getTableMetadataWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND (directoryID == %@) AND ((session == NULL) OR (session == ''))", app.activeAccount, directoryID] context:nil];
     
-    NSArray *records = [[NCManageDatabase sharedInstance] getMetadatasWithPreficate:[NSPredicate predicateWithFormat:@"(account == %@) AND (directoryID == %@) AND ((session == NULL) OR (session == ''))", app.activeAccount, directoryID] sorted:nil ascending:NO];
+    NSArray *records = [[NCManageDatabase sharedInstance] getMetadatasWithPreficate:[NSPredicate predicateWithFormat:@"(account = %@) AND (directoryID = %@) AND (session = '')", app.activeAccount, directoryID] sorted:nil ascending:NO];
     
     for (TableMetadata *recordMetadata in records) {
             
@@ -1851,9 +1851,9 @@
         
         //[CCCoreData deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND (directoryID == %@) AND ((session == NULL) OR (session == ''))", metadataNet.account, metadataNet.directoryID]];
         
-        [[NCManageDatabase sharedInstance] deleteMetadata:[NSPredicate predicateWithFormat:@"(account == %@) AND (directoryID == %@) AND ((session == NULL) OR (session == ''))", metadataNet.account, metadataNet.directoryID]];
+        [[NCManageDatabase sharedInstance] deleteMetadata:[NSPredicate predicateWithFormat:@"(account = %@) AND (directoryID = %@) AND (session = '')", metadataNet.account, metadataNet.directoryID]];
         
-        recordsInSessions = [[NCManageDatabase sharedInstance] getMetadatasWithPreficate:[NSPredicate predicateWithFormat:@"(account == %@) AND (directoryID == %@) AND (session != NULL) AND (session != '')", metadataNet.account, metadataNet.directoryID] sorted:nil ascending:NO];
+        recordsInSessions = [[NCManageDatabase sharedInstance] getMetadatasWithPreficate:[NSPredicate predicateWithFormat:@"(account = %@) AND (directoryID = %@) AND (session != '')", metadataNet.account, metadataNet.directoryID] sorted:nil ascending:NO];
     
         //recordsInSessions = [CCCoreData getTableMetadataWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND (directoryID == %@) AND (session != NULL) AND (session != '')", metadataNet.account, metadataNet.directoryID] context:nil];
 
@@ -1867,7 +1867,7 @@
             
             //[CCCoreData deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND (directoryID == %@) AND (fileID = %@) AND ((session == NULL) OR (session == ''))", metadataNet.account, metadata.directoryID, metadata.fileID]];
             
-            [[NCManageDatabase sharedInstance] deleteMetadata:[NSPredicate predicateWithFormat:@"(account == %@) AND (directoryID == %@) AND (fileID = %@) AND ((session == NULL) OR (session == ''))", metadataNet.account, metadata.directoryID, metadata.fileID]];
+            [[NCManageDatabase sharedInstance] deleteMetadata:[NSPredicate predicateWithFormat:@"(account = %@) AND (directoryID = %@) AND (fileID = %@) AND (session = '')", metadataNet.account, metadata.directoryID, metadata.fileID]];
             
         }
         

+ 1 - 1
iOSClient/Move/CCMove.m

@@ -280,7 +280,7 @@
     // remove all record
     //[CCCoreData deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND (directoryID == %@) AND ((session == NULL) OR (session == ''))", activeAccount, metadataNet.directoryID]];
     
-    [[NCManageDatabase sharedInstance] deleteMetadata:[NSPredicate predicateWithFormat:@"(account == %@) AND (directoryID == %@) AND ((session == NULL) OR (session == ''))", activeAccount, metadataNet.directoryID]];
+    [[NCManageDatabase sharedInstance] deleteMetadata:[NSPredicate predicateWithFormat:@"(account = %@) AND (directoryID = %@) AND (session = '')", activeAccount, metadataNet.directoryID]];
     
     for (tableMetadata *metadata in metadatas) {