Skip to content
Snippets Groups Projects
Commit d37a7343 authored by syuilo's avatar syuilo
Browse files

fix(server): fix aggregation of retention

parent 7cb13cf8
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment