From aa4102c0228df7ce85cd331725762e15455803bc Mon Sep 17 00:00:00 2001 From: Fredrik Oseberg Date: Mon, 9 Aug 2021 15:44:54 +0200 Subject: [PATCH] fix: get features by project --- src/lib/services/project-health-service.ts | 25 ++++++++++++++++------ src/lib/types/model.ts | 9 -------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/lib/services/project-health-service.ts b/src/lib/services/project-health-service.ts index 7294a307bc..1a127b6dac 100644 --- a/src/lib/services/project-health-service.ts +++ b/src/lib/services/project-health-service.ts @@ -54,22 +54,33 @@ export default class ProjectHealthService { projectId: string, ): Promise { //const overview = await this.getProjectOverview(projectId, false); - const features = await this.featureToggleStore.getFeatures({ - projectId, + const features = await this.featureToggleStore.getFeaturesBy({ + project: projectId, }); + const overview = { name: 'test', description: '', features: features, members: 1, }; + const staleCount = this.staleCount(overview.features); + const activeCount = this.activeCount(overview.features); + const potentiallyStaleCount = await this.potentiallyStaleCount( + overview.features, + ); + const health = this.getHealthRating( + overview.features.length, + staleCount, + potentiallyStaleCount, + ); return { ...overview, - potentiallyStaleCount: await this.potentiallyStaleCount( - overview.features, - ), - activeCount: this.activeCount(overview.features), - staleCount: this.staleCount(overview.features), + health, + version: 1, + potentiallyStaleCount, + activeCount, + staleCount, }; } diff --git a/src/lib/types/model.ts b/src/lib/types/model.ts index a3b8cf5d33..cb46b32423 100644 --- a/src/lib/types/model.ts +++ b/src/lib/types/model.ts @@ -1,5 +1,3 @@ -import { IFeatureStrategy } from '../db/feature-strategy-store'; - export interface IConstraint { contextName: string; operator: string; @@ -39,13 +37,6 @@ export interface IFeatureToggleClient { strategies: IStrategyConfig[]; } -export interface IFeatureEnvironmentInfo { - name: string; - environment: string; - enabled: boolean; - strategies: IFeatureStrategy[]; -} - export interface FeatureToggleWithEnvironment extends FeatureToggle { environments: IEnvironmentDetail[]; }