diff --git a/apps/web/src/components/projects/ProjectModal.tsx b/apps/web/src/components/projects/ProjectModal.tsx index 49c0a41..1f4cca2 100644 --- a/apps/web/src/components/projects/ProjectModal.tsx +++ b/apps/web/src/components/projects/ProjectModal.tsx @@ -499,8 +499,8 @@ export function ProjectModal({ project, onClose }: ProjectModalProps) {
= threshold) return "red"; - if (offshoreRatio >= threshold - 10) return "yellow"; - return "green"; + // Higher offshore = better (cost-efficient). Threshold is the MINIMUM target. + if (offshoreRatio >= threshold) return "green"; // Target met + if (offshoreRatio >= threshold - 10) return "yellow"; // Close to target + return "red"; // Too little offshore } const SEVERITY_BADGE: Record = { @@ -127,7 +128,7 @@ export function ShoringIndicator({ projectId }: { projectId: string }) { {data.offshoreRatio}% offshore - {severity === "red" ? ` — Above ${data.threshold}% limit` : ""} + {severity === "green" ? " — Target met" : severity === "red" ? ` — Below ${data.threshold}% target` : ""}
diff --git a/packages/api/src/router/assistant-tools.ts b/packages/api/src/router/assistant-tools.ts index dd7c233..e46e7b6 100644 --- a/packages/api/src/router/assistant-tools.ts +++ b/packages/api/src/router/assistant-tools.ts @@ -1389,7 +1389,7 @@ export const TOOL_DEFINITIONS: ToolDef[] = [ type: "function", function: { name: "get_shoring_ratio", - description: "Get the onshore/offshore staffing ratio for a project. Shows the percentage of work hours allocated to each country, whether the project exceeds its nearshore threshold, and a full country breakdown.", + description: "Get the onshore/offshore staffing ratio for a project. Higher offshore is better (cost-efficient). The threshold is the MINIMUM offshore target. Shows country breakdown and whether the target is met.", parameters: { type: "object", properties: { @@ -5576,9 +5576,13 @@ const executors = { .map(([code, info]) => `${code} ${info.pct}% (${info.resourceCount} people)`) .join(", "); - const warning = result.isAboveThreshold ? ` -- Above ${threshold}% offshore threshold!` : ""; + const status = result.offshoreRatio >= threshold + ? `Target met (>=${threshold}% offshore)` + : result.offshoreRatio >= threshold - 10 + ? `Close to target (${threshold}% offshore needed)` + : `Below target — only ${result.offshoreRatio}% offshore, need ${threshold}%`; - return `Project "${project.name}" (${project.shortCode}): ${result.onshoreRatio}% onshore (${onshoreCode}), ${result.offshoreRatio}% offshore. Breakdown: ${countryParts}.${warning}${result.unknownCount > 0 ? ` (${result.unknownCount} resource(s) without country)` : ""}`; + return `Project "${project.name}" (${project.shortCode}): ${result.onshoreRatio}% onshore (${onshoreCode}), ${result.offshoreRatio}% offshore. ${status}. Breakdown: ${countryParts}.${result.unknownCount > 0 ? ` (${result.unknownCount} resource(s) without country)` : ""}`; }, };