diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-01-27 11:10:37 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2023-01-27 11:10:37 +0900 |
| commit | d37a734379c52b8ad7edc983e3b06a7f3cdb79b6 (patch) | |
| tree | 7c7a5f65cd35fe4812cc4b6a01355d12d84cc5b6 /packages/backend/src/queue | |
| parent | proxyRemoteFilesがfalseならリモートカスタム絵文字は直リン... (diff) | |
| download | sharkey-d37a734379c52b8ad7edc983e3b06a7f3cdb79b6.tar.gz sharkey-d37a734379c52b8ad7edc983e3b06a7f3cdb79b6.tar.bz2 sharkey-d37a734379c52b8ad7edc983e3b06a7f3cdb79b6.zip | |
fix(server): fix aggregation of retention
Diffstat (limited to 'packages/backend/src/queue')
| -rw-r--r-- | packages/backend/src/queue/processors/AggregateRetentionProcessorService.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/backend/src/queue/processors/AggregateRetentionProcessorService.ts b/packages/backend/src/queue/processors/AggregateRetentionProcessorService.ts index 4650da76bb..da4ae88557 100644 --- a/packages/backend/src/queue/processors/AggregateRetentionProcessorService.ts +++ b/packages/backend/src/queue/processors/AggregateRetentionProcessorService.ts @@ -57,8 +57,15 @@ export class AggregateRetentionProcessorService { usersCount: targetUserIds.length, }); + // 今日活動したユーザーを全て取得 + const activeUsers = await this.usersRepository.findBy({ + host: IsNull(), + lastActiveDate: MoreThan(new Date(Date.now() - (1000 * 60 * 60 * 24))), + }); + const activeUsersIds = activeUsers.map(u => u.id); + for (const record of pastRecords) { - const retention = record.userIds.filter(id => targetUserIds.includes(id)).length; + const retention = record.userIds.filter(id => activeUsersIds.includes(id)).length; const data = deepClone(record.data); data[dateKey] = retention; |