[mob] Fix issue with random photo entering cluster

This commit is contained in:
laurenspriem
2024-04-05 15:49:35 +05:30
parent 0777013b93
commit 723253a12c
2 changed files with 4 additions and 10 deletions

View File

@@ -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;

View File

@@ -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 {};
}