refactor: rule of coverage are in one place
This commit is contained in:
@@ -15,6 +15,10 @@ import {
|
||||
Cell,
|
||||
Legend,
|
||||
} from "recharts";
|
||||
import {
|
||||
COVERAGE_OBJECTIVES,
|
||||
isCoverageBelowObjective,
|
||||
} from "@/lib/evaluation-utils";
|
||||
import {
|
||||
Tooltip as UITooltip,
|
||||
TooltipContent,
|
||||
@@ -82,9 +86,11 @@ export function TeamStats({
|
||||
// Gaps critiques par catégorie, séparés par importance
|
||||
const criticalGapsByCategory = skillGaps.reduce((acc, gap) => {
|
||||
const isIncontournableUndercovered =
|
||||
gap.importance === "incontournable" && gap.coverage < 75;
|
||||
gap.importance === "incontournable" &&
|
||||
isCoverageBelowObjective(gap.coverage, gap.importance);
|
||||
const isMajeureUndercovered =
|
||||
gap.importance === "majeure" && gap.coverage < 60;
|
||||
gap.importance === "majeure" &&
|
||||
isCoverageBelowObjective(gap.coverage, gap.importance);
|
||||
|
||||
if (isIncontournableUndercovered || isMajeureUndercovered) {
|
||||
if (!acc[gap.category]) {
|
||||
@@ -161,8 +167,13 @@ export function TeamStats({
|
||||
<div className="text-xs space-y-1">
|
||||
<p>Compétences critiques sous-couvertes :</p>
|
||||
<ul className="list-disc list-inside space-y-0.5">
|
||||
<li>Incontournables : couverture < 75%</li>
|
||||
<li>Majeures : couverture < 60%</li>
|
||||
<li>
|
||||
Incontournables : couverture <{" "}
|
||||
{COVERAGE_OBJECTIVES.incontournable}%
|
||||
</li>
|
||||
<li>
|
||||
Majeures : couverture < {COVERAGE_OBJECTIVES.majeure}%
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</TooltipContent>
|
||||
@@ -205,7 +216,10 @@ export function TeamStats({
|
||||
<TooltipContent className="bg-slate-900 text-slate-200 border border-slate-700">
|
||||
<div className="text-xs">
|
||||
<p>Compétences incontournables</p>
|
||||
<p className="text-slate-400">Objectif : 75% de couverture</p>
|
||||
<p className="text-slate-400">
|
||||
Objectif : {COVERAGE_OBJECTIVES.incontournable}% de
|
||||
couverture
|
||||
</p>
|
||||
</div>
|
||||
</TooltipContent>
|
||||
</UITooltip>
|
||||
@@ -343,16 +357,16 @@ export function TeamStats({
|
||||
formatter={(value, name) => {
|
||||
const label =
|
||||
name === "incontournable"
|
||||
? "Incontournables (obj. 75%)"
|
||||
: "Majeures (obj. 60%)";
|
||||
? `Incontournables (obj. ${COVERAGE_OBJECTIVES.incontournable}%)`
|
||||
: `Majeures (obj. ${COVERAGE_OBJECTIVES.majeure}%)`;
|
||||
return [value, label];
|
||||
}}
|
||||
/>
|
||||
<Legend
|
||||
formatter={(value) => {
|
||||
return value === "incontournable"
|
||||
? "Incontournables (obj. 75%)"
|
||||
: "Majeures (obj. 60%)";
|
||||
? `Incontournables (obj. ${COVERAGE_OBJECTIVES.incontournable}%)`
|
||||
: `Majeures (obj. ${COVERAGE_OBJECTIVES.majeure}%)`;
|
||||
}}
|
||||
wrapperStyle={{
|
||||
paddingTop: "20px",
|
||||
|
||||
Reference in New Issue
Block a user