sponsor match is binary
This commit is contained in:
parent
1fd6a4b4c2
commit
30385cfe24
@ -103,31 +103,15 @@ const SponsorBadge: React.FC<SponsorBadgeProps> = ({ score, names, onCheck }) =>
|
||||
);
|
||||
}
|
||||
|
||||
// If no score (and no callback), show nothing
|
||||
if (score == null || score < 50) {
|
||||
// If no score (and no callback), or error in score, show nothing
|
||||
if (score == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Color tokens based on score
|
||||
const getScoreTokens = (s: number) => {
|
||||
if (s >= 90) return {
|
||||
badge: "border-emerald-500/40 bg-emerald-500/15 text-emerald-300",
|
||||
label: "Visa Sponsor"
|
||||
};
|
||||
if (s >= 70) return {
|
||||
badge: "border-amber-500/40 bg-amber-500/15 text-amber-300",
|
||||
label: "Likely Sponsor"
|
||||
};
|
||||
return {
|
||||
badge: "border-orange-500/40 bg-orange-500/15 text-orange-300",
|
||||
label: "Possible Sponsor"
|
||||
};
|
||||
};
|
||||
|
||||
const tokens = getScoreTokens(score);
|
||||
const tooltipContent = parsedNames.length > 0
|
||||
? `${score}% match: ${parsedNames.join(", ")}`
|
||||
: `${score}% match with visa sponsor list`;
|
||||
const isFound = score >= 95;
|
||||
const tooltipContent = isFound
|
||||
? `Confirmed Visa Sponsor (${score}% match: ${parsedNames.join(", ")})`
|
||||
: `Sponsor Not Found (${score}% match${parsedNames.length > 0 ? `: ${parsedNames.join(", ")}` : ""})`;
|
||||
|
||||
return (
|
||||
<TooltipProvider>
|
||||
@ -135,16 +119,18 @@ const SponsorBadge: React.FC<SponsorBadgeProps> = ({ score, names, onCheck }) =>
|
||||
<TooltipTrigger asChild>
|
||||
<span
|
||||
className={cn(
|
||||
"inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wide cursor-help",
|
||||
tokens.badge
|
||||
"inline-flex items-center gap-1 rounded-full border px-1 py-1 text-[9px] font-semibold uppercase tracking-wide cursor-help transition-colors",
|
||||
isFound
|
||||
? "border-emerald-500/40 bg-emerald-500/15 text-emerald-400"
|
||||
: "border-slate-500/40 bg-slate-500/15 text-slate-400"
|
||||
)}
|
||||
>
|
||||
<Shield className="h-2.5 w-2.5" />
|
||||
{score}%
|
||||
<Shield className={cn("h-3 w-3", isFound ? "fill-emerald-400/20" : "")} />
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top" className="max-w-xs">
|
||||
<p className="text-xs">{tooltipContent}</p>
|
||||
<p className="text-xs font-medium">{isFound ? "Found" : "Not Found"}</p>
|
||||
<p className="text-[10px] opacity-80 mt-1">{tooltipContent}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
|
||||
@ -31,6 +31,9 @@ vi.mock("../../components", () => ({
|
||||
DiscoveredPanel: ({ job }: { job: Job | null }) => (
|
||||
<div data-testid="discovered-panel">{job?.id ?? "no-job"}</div>
|
||||
),
|
||||
JobHeader: () => <div data-testid="job-header" />,
|
||||
FitAssessment: () => <div data-testid="fit-assessment" />,
|
||||
TailoredSummary: () => <div data-testid="tailored-summary" />,
|
||||
}));
|
||||
|
||||
vi.mock("../../components/ReadyPanel", () => ({
|
||||
|
||||
@ -160,7 +160,7 @@ jobsRouter.post('/:id/check-sponsor', async (req: Request, res: Response) => {
|
||||
minScore: 50,
|
||||
});
|
||||
|
||||
let sponsorMatchScore: number | null = null;
|
||||
let sponsorMatchScore = 0;
|
||||
let sponsorMatchNames: string | null = null;
|
||||
|
||||
if (sponsorResults.length > 0) {
|
||||
@ -177,7 +177,7 @@ jobsRouter.post('/:id/check-sponsor', async (req: Request, res: Response) => {
|
||||
|
||||
// Update job with sponsor match info
|
||||
const updatedJob = await jobsRepo.updateJob(job.id, {
|
||||
sponsorMatchScore: sponsorMatchScore ?? undefined,
|
||||
sponsorMatchScore: sponsorMatchScore,
|
||||
sponsorMatchNames: sponsorMatchNames ?? undefined,
|
||||
});
|
||||
|
||||
|
||||
@ -295,7 +295,7 @@ export async function runPipeline(config: Partial<PipelineConfig> = {}): Promise
|
||||
});
|
||||
|
||||
// Calculate sponsor match score using fuzzy search
|
||||
let sponsorMatchScore: number | undefined;
|
||||
let sponsorMatchScore = 0;
|
||||
let sponsorMatchNames: string | undefined;
|
||||
|
||||
if (job.employer) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user