Browse Source

[mob][photos] Forgot method

laurenspriem 1 year ago
parent
commit
7fd5ffc0e6
1 changed files with 14 additions and 0 deletions
  1. 14 0
      mobile/lib/face/db.dart

+ 14 - 0
mobile/lib/face/db.dart

@@ -348,6 +348,20 @@ class FaceMLDataDB {
     return result;
   }
 
+  Future<Map<int, Iterable<String>>> getAllClusterIdToFaceIDs() async {
+    final db = await instance.sqliteAsyncDB;
+    final Map<int, List<String>> result = {};
+    final List<Map<String, dynamic>> maps = await db.getAll(
+      'SELECT $fcClusterID, $fcFaceId FROM $faceClustersTable',
+    );
+    for (final map in maps) {
+      final clusterID = map[fcClusterID] as int;
+      final faceID = map[fcFaceId] as String;
+      result.putIfAbsent(clusterID, () => <String>[]).add(faceID);
+    }
+    return result;
+  }
+
   Future<Iterable<String>> getFaceIDsForCluster(int clusterID) async {
     final db = await instance.sqliteAsyncDB;
     final List<Map<String, dynamic>> maps = await db.getAll(