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);
|
||||
}
|
||||
|
||||
Future<List<int>> getUploadedFileIDsToBeUpdated() async {
|
||||
Future<List<int>> getUploadedFileIDsToBeUpdated(int ownerID) async {
|
||||
final db = await instance.database;
|
||||
final rows = await db.query(
|
||||
filesTable,
|
||||
columns: [columnUploadedFileID],
|
||||
where:
|
||||
'($columnLocalID IS NOT NULL AND ($columnUploadedFileID IS NOT NULL AND $columnUploadedFileID IS NOT -1) AND $columnUpdationTime IS NULL)',
|
||||
where: '($columnLocalID IS NOT NULL AND $columnOwnerID = ? AND '
|
||||
'($columnUploadedFileID '
|
||||
'IS NOT '
|
||||
'NULL AND $columnUploadedFileID IS NOT -1) AND $columnUpdationTime IS NULL)',
|
||||
whereArgs: [ownerID],
|
||||
orderBy: '$columnCreationTime DESC',
|
||||
distinct: true,
|
||||
);
|
||||
|
|
|
@ -299,8 +299,11 @@ class RemoteSyncService {
|
|||
}
|
||||
|
||||
Future<bool> _uploadFiles(List<File> filesToBeUploaded) async {
|
||||
final updatedFileIDs = await _db.getUploadedFileIDsToBeUpdated();
|
||||
_logger.info(updatedFileIDs.length.toString() + " files updated.");
|
||||
int ownerID = Configuration.instance.getUserID();
|
||||
final updatedFileIDs = await _db.getUploadedFileIDsToBeUpdated(ownerID);
|
||||
if (updatedFileIDs.isNotEmpty) {
|
||||
_logger.info("Identified ${updatedFileIDs.length} files for reupload");
|
||||
}
|
||||
|
||||
_completedUploads = 0;
|
||||
int toBeUploaded = filesToBeUploaded.length + updatedFileIDs.length;
|
||||
|
|
Loading…
Reference in a new issue