From 728d8fd4ae7fdf3b1a78c5715f4f4e96cb0cbd03 Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Sat, 31 Oct 2026 09:11:13 +0000 Subject: [PATCH] style(api): extract calculationType constant in portfolio-changed listener --- apps/api/src/events/portfolio-changed.listener.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/api/src/events/portfolio-changed.listener.ts b/apps/api/src/events/portfolio-changed.listener.ts index 16d64f1a07..0f60319afb 100644 --- a/apps/api/src/events/portfolio-changed.listener.ts +++ b/apps/api/src/events/portfolio-changed.listener.ts @@ -69,25 +69,25 @@ export class PortfolioChangedListener { userSettings }); + const calculationType = + userSettings.performanceCalculationType ?? + PerformanceCalculationType.ROAI; + // Recompute in the background to avoid a cold start on the next request await this.portfolioSnapshotService.addJobToQueue({ data: { + calculationType, filters, userId, - calculationType: - userSettings.performanceCalculationType ?? - PerformanceCalculationType.ROAI, userCurrency: userSettings.baseCurrency ?? DEFAULT_CURRENCY }, name: PORTFOLIO_SNAPSHOT_PROCESS_JOB_NAME, opts: { ...PORTFOLIO_SNAPSHOT_PROCESS_JOB_OPTIONS, jobId: this.redisCacheService.getPortfolioSnapshotKey({ + calculationType, filters, - userId, - calculationType: - userSettings.performanceCalculationType ?? - PerformanceCalculationType.ROAI + userId }), priority: PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE_PRIORITY_LOW }