Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob] Fix issue with random photo entering cluster

laurenspriem723253a12c55
diff --git a/mobile/lib/face/db.dart b/mobile/lib/face/db.dart
index 1c37551be1..63ddef47ef 100644
--- a/mobile/lib/face/db.dart
+++ b/mobile/lib/face/db.dart
@@ -736,7 +736,7 @@ class FaceMLDataDB {
for (final enteFile in files) {
fileIds.add(enteFile.uploadedFileID.toString());
}
- int maxClusterID = DateTime.now().millisecondsSinceEpoch;
+ int maxClusterID = DateTime.now().microsecondsSinceEpoch;
final Map<String, int> faceIDToClusterID = {};
for (final row in faceIdsResult) {
final faceID = row[fcFaceId] as String;
@@ -762,7 +762,7 @@ class FaceMLDataDB {
for (final enteFile in files) {
fileIds.add(enteFile.uploadedFileID.toString());
}
- int maxClusterID = DateTime.now().millisecondsSinceEpoch;
+ int maxClusterID = DateTime.now().microsecondsSinceEpoch;
final Map<String, int> faceIDToClusterID = {};
for (final row in faceIdsResult) {
final faceID = row[fcFaceId] as String;
diff --git a/mobile/lib/services/machine_learning/face_ml/face_clustering/linear_clustering_service.dart b/mobile/lib/services/machine_learning/face_ml/face_clustering/linear_clustering_service.dart
index 86b747551a..ee7322456c 100644
--- a/mobile/lib/services/machine_learning/face_ml/face_clustering/linear_clustering_service.dart
+++ b/mobile/lib/services/machine_learning/face_ml/face_clustering/linear_clustering_service.dart
@@ -353,14 +353,8 @@ class FaceClustering {
// Make sure the first face has a clusterId
final int totalFaces = sortedFaceInfos.length;
// set current epoch time as clusterID
- int clusterID = DateTime.now().millisecondsSinceEpoch;
- if (sortedFaceInfos.isNotEmpty) {
- if (sortedFaceInfos.first.clusterId == null) {
- sortedFaceInfos.first.clusterId = clusterID;
- } else {
- clusterID = sortedFaceInfos.first.clusterId!;
- }
- } else {
+ int clusterID = DateTime.now().microsecondsSinceEpoch;
+ if (sortedFaceInfos.isEmpty) {
return {};
}