Browse Source

Fix data gathering of manual activities

pull/7997/head
Thomas Kaul 2 weeks ago
parent
commit
3e81e36d94
  1. 13
      apps/api/src/app/activities/activities.controller.ts
  2. 2
      apps/api/src/app/activities/activities.service.ts

13
apps/api/src/app/activities/activities.controller.ts

@ -284,15 +284,18 @@ export class ActivitiesController {
user: { connect: { id: userId } } user: { connect: { id: userId } }
}); });
if (dataSource && !isActivityInFuture({ date: activity.date })) { if (
// Gather symbol data in the background, if data source is set activity.SymbolProfile.dataSource !== 'MANUAL' &&
// (not MANUAL) and the date is not in the future !isActivityInFuture({ date: activity.date })
) {
// Gather symbol data in the background, if the data source is not
// MANUAL and the date is not in the future
this.dataGatheringService.gatherSymbols({ this.dataGatheringService.gatherSymbols({
dataGatheringItems: [ dataGatheringItems: [
{ {
dataSource, dataSource: activity.SymbolProfile.dataSource,
date: activity.date, date: activity.date,
symbol: data.symbol symbol: activity.SymbolProfile.symbol
} }
], ],
priority: DATA_GATHERING_QUEUE_PRIORITY_HIGH priority: DATA_GATHERING_QUEUE_PRIORITY_HIGH

2
apps/api/src/app/activities/activities.service.ts

@ -183,7 +183,7 @@ export class ActivitiesService {
updateAccountBalance?: boolean; updateAccountBalance?: boolean;
userId: string; userId: string;
} }
): Promise<Order> { ): Promise<Prisma.OrderGetPayload<{ include: { SymbolProfile: true } }>> {
const tags = data.tags ?? []; const tags = data.tags ?? [];
await this.tagService.validateTagIds({ await this.tagService.validateTagIds({

Loading…
Cancel
Save