mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
fix(server): Correctly set album start and end dates (#4698)
* fix(server): Correctly set album start and end dates Currently, the query that retrieves album assets uses `ORDER BY assets.fileCreatedAt DESC`, which makes the existing logic return the start/end dates reversed (with `startDate` being taken from the first asset in the array). Instead of using the index-based approach, this change iterates through assets to get the min/max `fileCreatedAt`. This will avoid any future issues, if the query ordering changes, or becomes customizable (e.g. in case the user prefers to visualize older assets first). * fix: Maintain constant cost and only swap variables if needed
This commit is contained in:
committed by
GitHub
parent
87a0ba3db3
commit
b6f18cbe81
10
server/test/fixtures/asset.stub.ts
vendored
10
server/test/fixtures/asset.stub.ts
vendored
@@ -434,8 +434,8 @@ export const assetStub = {
|
||||
withLocation: Object.freeze<AssetEntity>({
|
||||
id: 'asset-with-favorite-id',
|
||||
deviceAssetId: 'device-asset-id',
|
||||
fileModifiedAt: new Date('2023-02-23T05:06:29.716Z'),
|
||||
fileCreatedAt: new Date('2023-02-23T05:06:29.716Z'),
|
||||
fileModifiedAt: new Date('2023-02-22T05:06:29.716Z'),
|
||||
fileCreatedAt: new Date('2023-02-22T05:06:29.716Z'),
|
||||
owner: userStub.user1,
|
||||
ownerId: 'user-id',
|
||||
deviceId: 'device-id',
|
||||
@@ -447,9 +447,9 @@ export const assetStub = {
|
||||
webpPath: null,
|
||||
thumbhash: null,
|
||||
encodedVideoPath: null,
|
||||
createdAt: new Date('2023-02-23T05:06:29.716Z'),
|
||||
updatedAt: new Date('2023-02-23T05:06:29.716Z'),
|
||||
localDateTime: new Date('2023-02-23T05:06:29.716Z'),
|
||||
createdAt: new Date('2023-02-22T05:06:29.716Z'),
|
||||
updatedAt: new Date('2023-02-22T05:06:29.716Z'),
|
||||
localDateTime: new Date('2023-02-22T05:06:29.716Z'),
|
||||
isFavorite: false,
|
||||
isArchived: false,
|
||||
isReadOnly: false,
|
||||
|
||||
Reference in New Issue
Block a user