mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-02 06:46:22 +01:00
Fix shared dir not considered when counting files for the photos timeline
This commit is contained in:
parent
97f1b25ae9
commit
5ec09d5c4c
4 changed files with 29 additions and 0 deletions
|
@ -574,6 +574,7 @@ class FilesController {
|
||||||
.map((e) => File(path: file_util.unstripPath(account, e))
|
.map((e) => File(path: file_util.unstripPath(account, e))
|
||||||
.strippedPathWithEmpty)
|
.strippedPathWithEmpty)
|
||||||
.toList(),
|
.toList(),
|
||||||
|
includeRelativeDirs: [accountPrefController.shareFolderValue],
|
||||||
excludeRelativeRoots: [remote_storage_util.remoteStorageDirRelativePath],
|
excludeRelativeRoots: [remote_storage_util.remoteStorageDirRelativePath],
|
||||||
mimes: file_util.supportedFormatMimes,
|
mimes: file_util.supportedFormatMimes,
|
||||||
);
|
);
|
||||||
|
|
|
@ -412,6 +412,7 @@ abstract class NpDb {
|
||||||
Future<DbFilesSummary> getFilesSummary({
|
Future<DbFilesSummary> getFilesSummary({
|
||||||
required DbAccount account,
|
required DbAccount account,
|
||||||
List<String>? includeRelativeRoots,
|
List<String>? includeRelativeRoots,
|
||||||
|
List<String>? includeRelativeDirs,
|
||||||
List<String>? excludeRelativeRoots,
|
List<String>? excludeRelativeRoots,
|
||||||
List<String>? mimes,
|
List<String>? mimes,
|
||||||
});
|
});
|
||||||
|
|
|
@ -620,6 +620,7 @@ extension SqliteDbFileExtension on SqliteDb {
|
||||||
Future<CountFileGroupsByDateResult> countFileGroupsByDate({
|
Future<CountFileGroupsByDateResult> countFileGroupsByDate({
|
||||||
required ByAccount account,
|
required ByAccount account,
|
||||||
List<String>? includeRelativeRoots,
|
List<String>? includeRelativeRoots,
|
||||||
|
List<String>? includeRelativeDirs,
|
||||||
List<String>? excludeRelativeRoots,
|
List<String>? excludeRelativeRoots,
|
||||||
List<String>? mimes,
|
List<String>? mimes,
|
||||||
bool? isArchived,
|
bool? isArchived,
|
||||||
|
@ -627,10 +628,23 @@ extension SqliteDbFileExtension on SqliteDb {
|
||||||
_log.info(
|
_log.info(
|
||||||
"[countFileGroupsByDate] "
|
"[countFileGroupsByDate] "
|
||||||
"includeRelativeRoots: $includeRelativeRoots, "
|
"includeRelativeRoots: $includeRelativeRoots, "
|
||||||
|
"includeRelativeDirs: $includeRelativeDirs, "
|
||||||
"excludeRelativeRoots: $excludeRelativeRoots, "
|
"excludeRelativeRoots: $excludeRelativeRoots, "
|
||||||
"mimes: $mimes",
|
"mimes: $mimes",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
List<int>? dirIds;
|
||||||
|
if (includeRelativeDirs?.isNotEmpty == true) {
|
||||||
|
final sqlAccount = await accountOf(account);
|
||||||
|
final result = await _accountFileRowIdsOf(ByAccount.sql(sqlAccount),
|
||||||
|
includeRelativeDirs!.map((e) => DbFileKey.byPath(e)).toList())
|
||||||
|
.notNull();
|
||||||
|
dirIds = result.values.map((e) => e.fileRowId).toList();
|
||||||
|
if (dirIds.length != includeRelativeDirs.length) {
|
||||||
|
_log.warning("Some dirs not found: $includeRelativeDirs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final count = countAll();
|
final count = countAll();
|
||||||
final localDate = accountFiles.bestDateTime
|
final localDate = accountFiles.bestDateTime
|
||||||
.modify(const DateTimeModifier.localTime())
|
.modify(const DateTimeModifier.localTime())
|
||||||
|
@ -647,6 +661,17 @@ extension SqliteDbFileExtension on SqliteDb {
|
||||||
for (final r in includeRelativeRoots) {
|
for (final r in includeRelativeRoots) {
|
||||||
q.byOrRelativePathPattern("$r/%");
|
q.byOrRelativePathPattern("$r/%");
|
||||||
}
|
}
|
||||||
|
if (dirIds != null) {
|
||||||
|
for (final i in dirIds) {
|
||||||
|
q.byOrDirRowId(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (dirIds != null) {
|
||||||
|
for (final i in dirIds) {
|
||||||
|
q.byOrDirRowId(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return q.build();
|
return q.build();
|
||||||
|
|
|
@ -474,6 +474,7 @@ class NpDbSqlite implements NpDb {
|
||||||
Future<DbFilesSummary> getFilesSummary({
|
Future<DbFilesSummary> getFilesSummary({
|
||||||
required DbAccount account,
|
required DbAccount account,
|
||||||
List<String>? includeRelativeRoots,
|
List<String>? includeRelativeRoots,
|
||||||
|
List<String>? includeRelativeDirs,
|
||||||
List<String>? excludeRelativeRoots,
|
List<String>? excludeRelativeRoots,
|
||||||
List<String>? mimes,
|
List<String>? mimes,
|
||||||
}) async {
|
}) async {
|
||||||
|
@ -481,6 +482,7 @@ class NpDbSqlite implements NpDb {
|
||||||
return await db.countFileGroupsByDate(
|
return await db.countFileGroupsByDate(
|
||||||
account: ByAccount.db(account),
|
account: ByAccount.db(account),
|
||||||
includeRelativeRoots: includeRelativeRoots,
|
includeRelativeRoots: includeRelativeRoots,
|
||||||
|
includeRelativeDirs: includeRelativeDirs,
|
||||||
excludeRelativeRoots: excludeRelativeRoots,
|
excludeRelativeRoots: excludeRelativeRoots,
|
||||||
mimes: mimes,
|
mimes: mimes,
|
||||||
isArchived: false,
|
isArchived: false,
|
||||||
|
|
Loading…
Reference in a new issue