fix: memories off by one (#16434)

This commit is contained in:
Jason Rasmussen
2025-02-28 13:51:28 -05:00
committed by GitHub
parent 5c0538e52c
commit e684062569
5 changed files with 24 additions and 24 deletions

View File

@@ -45,18 +45,18 @@ export class MemoryService extends BaseService {
for (const [userId, userIds] of Object.entries(userMap)) {
const memories = await this.assetRepository.getByDayOfYear(userIds, target);
for (const memory of memories) {
const data: OnThisDayData = { year: target.year - memory.yearsAgo };
for (const { year, assets } of memories) {
const data: OnThisDayData = { year };
await this.memoryRepository.create(
{
ownerId: userId,
type: MemoryType.ON_THIS_DAY,
data,
memoryAt: target.minus({ years: memory.yearsAgo }).toISO(),
memoryAt: target.set({ year }).toISO(),
showAt,
hideAt,
},
new Set(memory.assets.map(({ id }) => id)),
new Set(assets.map(({ id }) => id)),
);
}
}