Simplify
This commit is contained in:
@@ -1805,17 +1805,17 @@ class FilesDB with SqlDbBase {
|
||||
return FileLoadResult(filteredFiles, files.length == limit);
|
||||
}
|
||||
|
||||
Future<List<int>> getAllFileIDs() async {
|
||||
Future<int> remoteFileCount() async {
|
||||
final db = await instance.sqliteAsyncDB;
|
||||
final results = await db.getAll('''
|
||||
SELECT DISTINCT $columnUploadedFileID FROM $filesTable
|
||||
WHERE $columnUploadedFileID IS NOT NULL AND $columnUploadedFileID IS NOT -1
|
||||
''');
|
||||
final ids = <int>[];
|
||||
final ids = <int>{};
|
||||
for (final result in results) {
|
||||
ids.add(result[columnUploadedFileID] as int);
|
||||
}
|
||||
return ids;
|
||||
return ids.length;
|
||||
}
|
||||
|
||||
///Returns "columnName1 = ?, columnName2 = ?, ..."
|
||||
|
||||
@@ -814,7 +814,7 @@ class MLDataDB with SqlDbBase implements IMLDataDB<int> {
|
||||
|
||||
@override
|
||||
Future<double> getClusteredToIndexableFilesRatio() async {
|
||||
final int indexableFiles = (await getIndexableFileIDs()).length;
|
||||
final int indexableFiles = await getIndexableFileCount();
|
||||
final int clusteredFiles = await getClusteredOrFacelessFileCount();
|
||||
|
||||
return clusteredFiles / indexableFiles;
|
||||
|
||||
@@ -56,7 +56,7 @@ class FileMLInstruction {
|
||||
Future<IndexStatus> getIndexStatus() async {
|
||||
try {
|
||||
final mlDataDB = MLDataDB.instance;
|
||||
final int indexableFiles = (await getIndexableFileIDs()).length;
|
||||
final int indexableFiles = await getIndexableFileCount();
|
||||
final int facesIndexedFiles = await mlDataDB.getFaceIndexedFileCount();
|
||||
final int clipIndexedFiles = await mlDataDB.getClipIndexedFileCount();
|
||||
final int indexedFiles = math.min(facesIndexedFiles, clipIndexedFiles);
|
||||
@@ -320,9 +320,8 @@ bool _shouldDiscardRemoteEmbedding(FileDataEntity fileML) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<Set<int>> getIndexableFileIDs() async {
|
||||
final fileIDs = await FilesDB.instance.getAllFileIDs();
|
||||
return fileIDs.toSet();
|
||||
Future<int> getIndexableFileCount() async {
|
||||
return FilesDB.instance.remoteFileCount();
|
||||
}
|
||||
|
||||
Future<String> getImagePathForML(EnteFile enteFile) async {
|
||||
|
||||
Reference in New Issue
Block a user