diff --git a/src/lib/features/project-status/project-status-service.ts b/src/lib/features/project-status/project-status-service.ts index 6f7606db05..2900915654 100644 --- a/src/lib/features/project-status/project-status-service.ts +++ b/src/lib/features/project-status/project-status-service.ts @@ -72,7 +72,7 @@ export class ProjectStatusService { segments, }, activityCountByDate, - averageHealth, + averageHealth: Math.round(averageHealth), lifecycleSummary, }; } diff --git a/src/lib/features/project-status/projects-status.e2e.test.ts b/src/lib/features/project-status/projects-status.e2e.test.ts index 16c3397dec..85ea0faffa 100644 --- a/src/lib/features/project-status/projects-status.e2e.test.ts +++ b/src/lib/features/project-status/projects-status.e2e.test.ts @@ -69,6 +69,7 @@ afterAll(async () => { beforeEach(async () => { await db.stores.clientMetricsStoreV2.deleteAll(); + await db.rawDatabase('flag_trends').delete(); }); test('project insights should return correct count for each day', async () => { @@ -257,6 +258,19 @@ test('project health should be correct average', async () => { expect(body.averageHealth).toBe(40); }); +test('project health stats should round to nearest integer', async () => { + await insertHealthScore('2024-04', 6); + + await insertHealthScore('2024-05', 5); + + const { body } = await app.request + .get('/api/admin/projects/default/status') + .expect('Content-Type', /json/) + .expect(200); + + expect(body.averageHealth).toBe(6); +}); + test('project status contains lifecycle data', async () => { const { body } = await app.request .get('/api/admin/projects/default/status')