Fix: only attempt to update files ownedBy user
This commit is contained in:
parent
5ad1196172
commit
919186a9c9
|
@ -744,13 +744,16 @@ class FilesDB {
|
||||||
return convertToFiles(results);
|
return convertToFiles(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<int>> getUploadedFileIDsToBeUpdated() async {
|
Future<List<int>> getUploadedFileIDsToBeUpdated(int ownerID) async {
|
||||||
final db = await instance.database;
|
final db = await instance.database;
|
||||||
final rows = await db.query(
|
final rows = await db.query(
|
||||||
filesTable,
|
filesTable,
|
||||||
columns: [columnUploadedFileID],
|
columns: [columnUploadedFileID],
|
||||||
where:
|
where: '($columnLocalID IS NOT NULL AND $columnOwnerID = ? AND '
|
||||||
'($columnLocalID IS NOT NULL AND ($columnUploadedFileID IS NOT NULL AND $columnUploadedFileID IS NOT -1) AND $columnUpdationTime IS NULL)',
|
'($columnUploadedFileID '
|
||||||
|
'IS NOT '
|
||||||
|
'NULL AND $columnUploadedFileID IS NOT -1) AND $columnUpdationTime IS NULL)',
|
||||||
|
whereArgs: [ownerID],
|
||||||
orderBy: '$columnCreationTime DESC',
|
orderBy: '$columnCreationTime DESC',
|
||||||
distinct: true,
|
distinct: true,
|
||||||
);
|
);
|
||||||
|
|
|
@ -299,8 +299,11 @@ class RemoteSyncService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> _uploadFiles(List<File> filesToBeUploaded) async {
|
Future<bool> _uploadFiles(List<File> filesToBeUploaded) async {
|
||||||
final updatedFileIDs = await _db.getUploadedFileIDsToBeUpdated();
|
int ownerID = Configuration.instance.getUserID();
|
||||||
_logger.info(updatedFileIDs.length.toString() + " files updated.");
|
final updatedFileIDs = await _db.getUploadedFileIDsToBeUpdated(ownerID);
|
||||||
|
if (updatedFileIDs.isNotEmpty) {
|
||||||
|
_logger.info("Identified ${updatedFileIDs.length} files for reupload");
|
||||||
|
}
|
||||||
|
|
||||||
_completedUploads = 0;
|
_completedUploads = 0;
|
||||||
int toBeUploaded = filesToBeUploaded.length + updatedFileIDs.length;
|
int toBeUploaded = filesToBeUploaded.length + updatedFileIDs.length;
|
||||||
|
|
Loading…
Reference in a new issue