From cc855c59210e2a40acad91678033a3935ddce07a Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 12 Oct 2024 20:11:55 +0200 Subject: [PATCH] Refactoring --- apps/api/src/app/portfolio/rules.service.ts | 10 +++++----- .../client/src/app/components/rule/rule.component.html | 4 ++-- apps/client/src/app/components/rule/rule.component.ts | 3 ++- .../lib/interfaces/portfolio-report-rule.interface.ts | 8 ++++---- libs/common/src/lib/types/x-ray-rules-settings.type.ts | 4 +--- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/apps/api/src/app/portfolio/rules.service.ts b/apps/api/src/app/portfolio/rules.service.ts index 6c46db0a0..1d7acbd9d 100644 --- a/apps/api/src/app/portfolio/rules.service.ts +++ b/apps/api/src/app/portfolio/rules.service.ts @@ -25,13 +25,13 @@ export class RulesService { return { evaluation, value, - isActive: true, - key: rule.getKey(), - name: rule.getName(), - settings: { + configuration: { thresholdMax: isNumber(settings['thresholdMax']) ? true : false, thresholdMin: isNumber(settings['thresholdMin']) ? true : false - } as PortfolioReportRule['settings'] + } as PortfolioReportRule['configuration'], + isActive: true, + key: rule.getKey(), + name: rule.getName() }; } else { return { diff --git a/apps/client/src/app/components/rule/rule.component.html b/apps/client/src/app/components/rule/rule.component.html index 85dd3a490..aed14da63 100644 --- a/apps/client/src/app/components/rule/rule.component.html +++ b/apps/client/src/app/components/rule/rule.component.html @@ -64,8 +64,8 @@ @if ( rule?.isActive && - (rule?.settings.thresholdMax >= 0 || - rule?.settings.thresholdMin >= 0) + (rule?.configuration?.thresholdMax || + rule?.configuration?.thresholdMin) ) {