mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
refactor: rename timerange & remove isvalid
This commit is contained in:
@@ -27,12 +27,15 @@ class DriftMapRepository extends DriftDatabaseRepository {
|
||||
condition = condition & _db.remoteAssetEntity.isFavorite.equals(true);
|
||||
}
|
||||
|
||||
if (options.customTimeRange.isValid) {
|
||||
if (options.customTimeRange.from != null) {
|
||||
condition = condition & _db.remoteAssetEntity.createdAt.isBiggerOrEqualValue(options.customTimeRange.from!);
|
||||
final from = options.customTimeRange.from;
|
||||
final to = options.customTimeRange.to;
|
||||
|
||||
if (from != null || to != null) {
|
||||
if (from != null) {
|
||||
condition = condition & _db.remoteAssetEntity.createdAt.isBiggerOrEqualValue(from);
|
||||
}
|
||||
if (options.customTimeRange.to != null) {
|
||||
condition = condition & _db.remoteAssetEntity.createdAt.isSmallerOrEqualValue(options.customTimeRange.to!);
|
||||
if (to != null) {
|
||||
condition = condition & _db.remoteAssetEntity.createdAt.isSmallerOrEqualValue(to);
|
||||
}
|
||||
} else if (options.relativeDays > 0) {
|
||||
final fromDate = DateTime.now().subtract(Duration(days: options.relativeDays));
|
||||
|
||||
@@ -22,7 +22,7 @@ class TimelineMapOptions {
|
||||
final bool includeArchived;
|
||||
final bool withPartners;
|
||||
final int relativeDays;
|
||||
final CustomTimeRange customTimeRange;
|
||||
final TimeRange customTimeRange;
|
||||
|
||||
const TimelineMapOptions({
|
||||
required this.bounds,
|
||||
@@ -30,7 +30,7 @@ class TimelineMapOptions {
|
||||
this.includeArchived = false,
|
||||
this.withPartners = false,
|
||||
this.relativeDays = 0,
|
||||
this.customTimeRange = const CustomTimeRange(),
|
||||
this.customTimeRange = const TimeRange(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -531,13 +531,16 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
||||
query.where(_db.remoteAssetEntity.isFavorite.equals(true));
|
||||
}
|
||||
|
||||
if (options.customTimeRange.isValid) {
|
||||
final from = options.customTimeRange.from;
|
||||
final to = options.customTimeRange.to;
|
||||
|
||||
if (from != null || to != null) {
|
||||
// Use custom from/to filters
|
||||
if (options.customTimeRange.from != null) {
|
||||
query.where(_db.remoteAssetEntity.createdAt.isBiggerOrEqualValue(options.customTimeRange.from!));
|
||||
if (from != null) {
|
||||
query.where(_db.remoteAssetEntity.createdAt.isBiggerOrEqualValue(from));
|
||||
}
|
||||
if (options.customTimeRange.to != null) {
|
||||
query.where(_db.remoteAssetEntity.createdAt.isSmallerOrEqualValue(options.customTimeRange.to!));
|
||||
if (to != null) {
|
||||
query.where(_db.remoteAssetEntity.createdAt.isSmallerOrEqualValue(to));
|
||||
}
|
||||
} else if (options.relativeDays > 0) {
|
||||
// Use relative days
|
||||
@@ -582,13 +585,16 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
||||
query.where(_db.remoteAssetEntity.isFavorite.equals(true));
|
||||
}
|
||||
|
||||
if (options.customTimeRange.isValid) {
|
||||
final from = options.customTimeRange.from;
|
||||
final to = options.customTimeRange.to;
|
||||
|
||||
if (from != null || to != null) {
|
||||
// Use custom from/to filters
|
||||
if (options.customTimeRange.from != null) {
|
||||
query.where(_db.remoteAssetEntity.createdAt.isBiggerOrEqualValue(options.customTimeRange.from!));
|
||||
if (from != null) {
|
||||
query.where(_db.remoteAssetEntity.createdAt.isBiggerOrEqualValue(from));
|
||||
}
|
||||
if (options.customTimeRange.to != null) {
|
||||
query.where(_db.remoteAssetEntity.createdAt.isSmallerOrEqualValue(options.customTimeRange.to!));
|
||||
if (to != null) {
|
||||
query.where(_db.remoteAssetEntity.createdAt.isSmallerOrEqualValue(to));
|
||||
}
|
||||
} else if (options.relativeDays > 0) {
|
||||
// Use relative days
|
||||
|
||||
Reference in New Issue
Block a user