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

@@ -38,12 +38,15 @@ export class AssetService extends BaseService {
const userIds = [auth.user.id, ...partnerIds];
const groups = await this.assetRepository.getByDayOfYear(userIds, dto);
return groups.map(({ yearsAgo, assets }) => ({
yearsAgo,
// TODO move this to clients
title: `${yearsAgo} year${yearsAgo > 1 ? 's' : ''} ago`,
assets: assets.map((asset) => mapAsset(asset, { auth })),
}));
return groups.map(({ year, assets }) => {
const yearsAgo = DateTime.utc().year - year;
return {
yearsAgo,
// TODO move this to clients
title: `${yearsAgo} year${yearsAgo > 1 ? 's' : ''} ago`,
assets: assets.map((asset) => mapAsset(asset as AssetEntity, { auth })),
};
});
}
async getStatistics(auth: AuthDto, dto: AssetStatsDto) {