From 84979501fab0d90c322bf375eadc39330c5cf7a5 Mon Sep 17 00:00:00 2001 From: Julien Froidefond Date: Wed, 27 Aug 2025 14:57:10 +0200 Subject: [PATCH] fix: risk and colors on covergae in myteam page --- components/team-review/skill-matrix.tsx | 48 ++++++++++++------------- services/team-review-service.ts | 11 +++--- 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/components/team-review/skill-matrix.tsx b/components/team-review/skill-matrix.tsx index c67bc9e..22abfc8 100644 --- a/components/team-review/skill-matrix.tsx +++ b/components/team-review/skill-matrix.tsx @@ -39,8 +39,8 @@ export function SkillMatrix({ members, skillGaps }: SkillMatrixProps) { importanceOrder[b.importance] - importanceOrder[a.importance]; if (importanceDiff !== 0) return importanceDiff; - // Si même importance, trier par couverture (décroissant) - return (b.coverage || 0) - (a.coverage || 0); + // Si même importance, trier par couverture (ascendant) + return (a.coverage || 0) - (b.coverage || 0); }; const skillsByCategory = validSkillGaps.reduce((acc, skill) => { @@ -224,12 +224,11 @@ export function SkillMatrix({ members, skillGaps }: SkillMatrixProps) {
= 75 + ? "bg-green-500/50" + : (skill.coverage || 0) >= 50 + ? "bg-yellow-500/50" + : "bg-red-500/50" }`} style={{ width: `${Math.max( @@ -241,12 +240,11 @@ export function SkillMatrix({ members, skillGaps }: SkillMatrixProps) {
= 75 + ? "text-green-400" + : (skill.coverage || 0) >= 50 + ? "text-yellow-400" + : "text-red-400" }`} > {Math.round(skill.coverage || 0)}% @@ -354,12 +352,11 @@ export function SkillMatrix({ members, skillGaps }: SkillMatrixProps) {
= 75 + ? "bg-green-500/50" + : (skill.coverage || 0) >= 50 + ? "bg-yellow-500/50" + : "bg-red-500/50" }`} style={{ width: `${Math.max( @@ -371,12 +368,11 @@ export function SkillMatrix({ members, skillGaps }: SkillMatrixProps) {
= 75 + ? "text-green-400" + : (skill.coverage || 0) >= 50 + ? "text-yellow-400" + : "text-red-400" }`} > {Math.round(skill.coverage || 0)}% diff --git a/services/team-review-service.ts b/services/team-review-service.ts index abc9d7a..08a624e 100644 --- a/services/team-review-service.ts +++ b/services/team-review-service.ts @@ -158,13 +158,16 @@ export class TeamReviewService { ); const coverage = calculateSkillCoverage(levels, totalTeamMembers); - // Déterminer le niveau de risque en fonction de l'importance + // Déterminer le niveau de risque en fonction de l'importance et de la couverture + const coverageObjective = COVERAGE_OBJECTIVES[skill.importance]; const risk = - skill.importance === "incontournable" && experts === 0 + skill.importance === "incontournable" && coverage < coverageObjective ? "high" - : skill.importance === "majeure" && experts === 0 && mentors === 0 + : skill.importance === "majeure" && + coverage < coverageObjective && + experts === 0 ? "high" - : experts === 0 && mentors === 0 + : coverage < coverageObjective ? "medium" : "low";