|
|
@ -393,12 +393,7 @@ export class ActivitiesService { |
|
|
types?: ActivityType[]; |
|
|
types?: ActivityType[]; |
|
|
userId: string; |
|
|
userId: string; |
|
|
}): Promise<number> { |
|
|
}): Promise<number> { |
|
|
const activities = await this.prismaService.order.findMany({ |
|
|
const where = this.getWhereClause({ |
|
|
select: { |
|
|
|
|
|
id: true, |
|
|
|
|
|
symbolProfileId: true |
|
|
|
|
|
}, |
|
|
|
|
|
where: this.getWhereClause({ |
|
|
|
|
|
endDate, |
|
|
endDate, |
|
|
filters, |
|
|
filters, |
|
|
startDate, |
|
|
startDate, |
|
|
@ -406,28 +401,24 @@ export class ActivitiesService { |
|
|
userId, |
|
|
userId, |
|
|
includeDrafts: true, |
|
|
includeDrafts: true, |
|
|
withExcludedAccountsAndActivities: true |
|
|
withExcludedAccountsAndActivities: true |
|
|
}) |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const { count } = await this.prismaService.order.deleteMany({ |
|
|
const activities = await this.prismaService.order.findMany({ |
|
|
where: { |
|
|
where, |
|
|
id: { |
|
|
distinct: ['symbolProfileId'], |
|
|
in: activities.map(({ id }) => { |
|
|
select: { symbolProfileId: true } |
|
|
return id; |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const symbolProfiles = |
|
|
const { count } = await this.prismaService.order.deleteMany({ where }); |
|
|
await this.symbolProfileService.getSymbolProfilesByIds( |
|
|
|
|
|
|
|
|
const [benchmarkAssetProfiles, symbolProfiles] = await Promise.all([ |
|
|
|
|
|
this.benchmarkService.getBenchmarkAssetProfiles(), |
|
|
|
|
|
this.symbolProfileService.getSymbolProfilesByIds( |
|
|
activities.map(({ symbolProfileId }) => { |
|
|
activities.map(({ symbolProfileId }) => { |
|
|
return symbolProfileId; |
|
|
return symbolProfileId; |
|
|
}) |
|
|
}) |
|
|
); |
|
|
) |
|
|
|
|
|
]); |
|
|
const benchmarkAssetProfiles = |
|
|
|
|
|
await this.benchmarkService.getBenchmarkAssetProfiles(); |
|
|
|
|
|
|
|
|
|
|
|
for (const { |
|
|
for (const { |
|
|
activitiesCount, |
|
|
activitiesCount, |
|
|
|