mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	1-3093: round the project health (#8718)
This PR rounds the average health score we show for a project. With fractional numbers, it'd often overflow the graph. It also doesn't really give you much extra info, so we can round it. The rounding is then used both in the text, in the graph, and to calculate the graph fill percentage. Before:  After: 
This commit is contained in:
		
							parent
							
								
									20c5a6f7ce
								
							
						
					
					
						commit
						a964868e00
					
				| @ -72,7 +72,7 @@ export class ProjectStatusService { | ||||
|                 segments, | ||||
|             }, | ||||
|             activityCountByDate, | ||||
|             averageHealth, | ||||
|             averageHealth: Math.round(averageHealth), | ||||
|             lifecycleSummary, | ||||
|         }; | ||||
|     } | ||||
|  | ||||
| @ -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') | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user