mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix: regression: sort day by fileCreatedAt again (#18732)
* fix: regression: sort day by fileCreatedAt again * lint * e2e test * inline function * e2e * Address comments. Drop dayGroup and timezone in favor of localOffsetMinutes * lint and some api-doc * lint, more api-doc * format * Move minutes to fractional hours * make sql * merge/conflict * merge fallout, review comments * spelling * drop offset from returned date * move description into decorator where possible, regen api
This commit is contained in:
parent
81423420c8
commit
55f4e93456
23 changed files with 687 additions and 247 deletions
|
|
@ -3,10 +3,10 @@ import { handleError } from '$lib/utils/handle-error';
|
|||
import {
|
||||
formatBucketTitle,
|
||||
formatGroupTitle,
|
||||
fromLocalDateTimeToObject,
|
||||
fromTimelinePlainDate,
|
||||
fromTimelinePlainDateTime,
|
||||
fromTimelinePlainYearMonth,
|
||||
getTimes,
|
||||
type TimelinePlainDateTime,
|
||||
type TimelinePlainYearMonth,
|
||||
} from '$lib/utils/timeline-util';
|
||||
|
|
@ -153,8 +153,12 @@ export class AssetBucket {
|
|||
|
||||
addAssets(bucketAssets: TimeBucketAssetResponseDto) {
|
||||
const addContext = new AddContext();
|
||||
const people: string[] = [];
|
||||
for (let i = 0; i < bucketAssets.id.length; i++) {
|
||||
const { localDateTime, fileCreatedAt } = getTimes(
|
||||
bucketAssets.fileCreatedAt[i],
|
||||
bucketAssets.localOffsetHours[i],
|
||||
);
|
||||
|
||||
const timelineAsset: TimelineAsset = {
|
||||
city: bucketAssets.city[i],
|
||||
country: bucketAssets.country[i],
|
||||
|
|
@ -166,9 +170,9 @@ export class AssetBucket {
|
|||
isTrashed: bucketAssets.isTrashed[i],
|
||||
isVideo: !bucketAssets.isImage[i],
|
||||
livePhotoVideoId: bucketAssets.livePhotoVideoId[i],
|
||||
localDateTime: fromLocalDateTimeToObject(bucketAssets.localDateTime[i]),
|
||||
localDateTime,
|
||||
fileCreatedAt,
|
||||
ownerId: bucketAssets.ownerId[i],
|
||||
people,
|
||||
projectionType: bucketAssets.projectionType[i],
|
||||
ratio: bucketAssets.ratio[i],
|
||||
stack: bucketAssets.stack?.[i]
|
||||
|
|
@ -179,6 +183,7 @@ export class AssetBucket {
|
|||
}
|
||||
: null,
|
||||
thumbhash: bucketAssets.thumbhash[i],
|
||||
people: null, // People are not included in the bucket assets
|
||||
};
|
||||
this.addTimelineAsset(timelineAsset, addContext);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ export class AssetDateGroup {
|
|||
|
||||
sortAssets(sortOrder: AssetOrder = AssetOrder.Desc) {
|
||||
const sortFn = plainDateTimeCompare.bind(undefined, sortOrder === AssetOrder.Asc);
|
||||
this.intersectingAssets.sort((a, b) => sortFn(a.asset.localDateTime, b.asset.localDateTime));
|
||||
this.intersectingAssets.sort((a, b) => sortFn(a.asset.fileCreatedAt, b.asset.fileCreatedAt));
|
||||
}
|
||||
|
||||
getFirstAsset() {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { websocketEvents } from '$lib/stores/websocket';
|
|||
import { CancellableTask } from '$lib/utils/cancellable-task';
|
||||
import {
|
||||
plainDateTimeCompare,
|
||||
toISOLocalDateTime,
|
||||
toISOYearMonthUTC,
|
||||
toTimelineAsset,
|
||||
type TimelinePlainDate,
|
||||
type TimelinePlainDateTime,
|
||||
|
|
@ -573,7 +573,7 @@ export class AssetStore {
|
|||
if (bucket.getFirstAsset()) {
|
||||
return;
|
||||
}
|
||||
const timeBucket = toISOLocalDateTime(bucket.yearMonth);
|
||||
const timeBucket = toISOYearMonthUTC(bucket.yearMonth);
|
||||
const key = authManager.key;
|
||||
const bucketResponse = await getTimeBucket(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ export type TimelineAsset = {
|
|||
ratio: number;
|
||||
thumbhash: string | null;
|
||||
localDateTime: TimelinePlainDateTime;
|
||||
fileCreatedAt: TimelinePlainDateTime;
|
||||
visibility: AssetVisibility;
|
||||
isFavorite: boolean;
|
||||
isTrashed: boolean;
|
||||
|
|
@ -29,7 +30,7 @@ export type TimelineAsset = {
|
|||
livePhotoVideoId: string | null;
|
||||
city: string | null;
|
||||
country: string | null;
|
||||
people: string[];
|
||||
people: string[] | null;
|
||||
};
|
||||
|
||||
export type AssetOperation = (asset: TimelineAsset) => { remove: boolean };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue