mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-27 16:33:08 +02:00
fix(server): fix aggregation of retention
This commit is contained in:
parent
7cb13cf839
commit
d37a734379
1 changed files with 8 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue