From 4b0bf4379fb4bcb185eebf79ad4437d2e5c1fb97 Mon Sep 17 00:00:00 2001 From: Sai-karthik Date: Tue, 7 Jul 2026 20:10:16 +0000 Subject: [PATCH] Fix QX task impact registry initialization --- src/v1/curator/task-registry.ts | 35 +++++++++++++++++---------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/v1/curator/task-registry.ts b/src/v1/curator/task-registry.ts index a1fb567..7ef0526 100644 --- a/src/v1/curator/task-registry.ts +++ b/src/v1/curator/task-registry.ts @@ -187,18 +187,18 @@ type QxKpiWeight = { dims: QxDimension[]; }; -const QX_PROFILE_BY_ICP: Record = { - student_recent_grad: "Student", - intern: "Student", - fresher_early_professional: "Student", - experienced_professional: "Prof_Leadership", - freelancer: "Prof_Creative", - founder: "Entrepreneur", - enterprise: "Prof_Leadership", -}; +type QxProfile = "Student" | "Prof_Leadership" | "Prof_Creative" | "Entrepreneur"; -const QX_PROFILE_KPI_WEIGHTS = { - Student: { +function qxProfileForIcp(icpId: CuratorIcpId): QxProfile { + if (icpId === "experienced_professional" || icpId === "enterprise") return "Prof_Leadership"; + if (icpId === "freelancer") return "Prof_Creative"; + if (icpId === "founder") return "Entrepreneur"; + return "Student"; +} + +function qxProfileKpiWeights(profile: QxProfile): Record { + const weights: Record> = { + Student: { 1: { weight: 2.84, dims: ["SQ"] }, 4: { weight: 1.41, dims: [] }, 10: { weight: 3.78, dims: [] }, @@ -213,7 +213,7 @@ const QX_PROFILE_KPI_WEIGHTS = { 39: { weight: 1.89, dims: ["IQ", "EQ", "SQ"] }, 41: { weight: 1.89, dims: ["EQ", "SQ"] }, }, - Prof_Leadership: { + Prof_Leadership: { 1: { weight: 3.34, dims: ["SQ"] }, 5: { weight: 2.5, dims: ["IQ"] }, 6: { weight: 3.34, dims: ["SQ"] }, @@ -229,7 +229,7 @@ const QX_PROFILE_KPI_WEIGHTS = { 39: { weight: 1.67, dims: ["IQ", "EQ", "SQ"] }, 41: { weight: 2.08, dims: ["EQ", "SQ"] }, }, - Prof_Creative: { + Prof_Creative: { 1: { weight: 2.58, dims: ["SQ"] }, 4: { weight: 4.27, dims: [] }, 5: { weight: 3.44, dims: ["IQ"] }, @@ -246,7 +246,7 @@ const QX_PROFILE_KPI_WEIGHTS = { 39: { weight: 1.72, dims: ["IQ", "EQ", "SQ"] }, 41: { weight: 1.72, dims: ["EQ", "SQ"] }, }, - Entrepreneur: { + Entrepreneur: { 1: { weight: 2.05, dims: ["SQ"] }, 4: { weight: 2.05, dims: [] }, 5: { weight: 2.05, dims: ["IQ"] }, @@ -263,7 +263,9 @@ const QX_PROFILE_KPI_WEIGHTS = { 39: { weight: 1.37, dims: ["IQ", "EQ", "SQ"] }, 41: { weight: 1.37, dims: ["EQ", "SQ"] }, }, -} satisfies Record>; + }; + return weights[profile]; +} const FALLBACK_DIMS_BY_SERVICE: Partial> = { "social-branding-service": ["SQ"], @@ -314,8 +316,7 @@ function qxKpiIdForTask(task: StaticTaskRef): number { } function qxRawWeightForTask(icpId: CuratorIcpId, task: StaticTaskRef): number { - const profile = QX_PROFILE_BY_ICP[icpId]; - const kpiWeights: Record = QX_PROFILE_KPI_WEIGHTS[profile]; + const kpiWeights = qxProfileKpiWeights(qxProfileForIcp(icpId)); const kpi = kpiWeights[qxKpiIdForTask(task)]; const dims = kpi?.dims.length ? kpi.dims : FALLBACK_DIMS_BY_SERVICE[task.serviceId] ?? ["IQ"]; return kpi?.weight ?? dims.length;