mirror of
https://github.com/immich-app/immich.git
synced 2025-05-24 01:12:58 -04:00
fix: duplicate memories (#16432)
This commit is contained in:
parent
bfcde05b1c
commit
84cf0d1670
@ -30,20 +30,18 @@ export class MemoryService extends BaseService {
|
||||
const start = DateTime.utc().startOf('day').minus({ days: DAYS });
|
||||
|
||||
const state = await this.systemMetadataRepository.get(SystemMetadataKey.MEMORIES_STATE);
|
||||
let lastOnThisDayDate = state?.lastOnThisDayDate ? DateTime.fromISO(state?.lastOnThisDayDate) : start;
|
||||
const lastOnThisDayDate = state?.lastOnThisDayDate ? DateTime.fromISO(state.lastOnThisDayDate) : start;
|
||||
|
||||
// generate a memory +/- X days from today
|
||||
for (let i = 0; i <= DAYS * 2 + 1; i++) {
|
||||
for (let i = 0; i <= DAYS * 2; i++) {
|
||||
const target = start.plus({ days: i });
|
||||
if (lastOnThisDayDate > target) {
|
||||
if (lastOnThisDayDate >= target) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const showAt = target.startOf('day').toISO();
|
||||
const hideAt = target.endOf('day').toISO();
|
||||
|
||||
this.logger.log(`Creating memories for month=${target.month}, day=${target.day}`);
|
||||
|
||||
for (const [userId, userIds] of Object.entries(userMap)) {
|
||||
const memories = await this.assetRepository.getByDayOfYear(userIds, target);
|
||||
|
||||
@ -67,8 +65,6 @@ export class MemoryService extends BaseService {
|
||||
...state,
|
||||
lastOnThisDayDate: target.toISO(),
|
||||
});
|
||||
|
||||
lastOnThisDayDate = target;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user