Fix QX fallback dimension initialization
This commit is contained in:
@@ -267,18 +267,14 @@ function qxProfileKpiWeights(profile: QxProfile): Record<number, QxKpiWeight> {
|
||||
return weights[profile];
|
||||
}
|
||||
|
||||
const FALLBACK_DIMS_BY_SERVICE: Partial<Record<CuratorServiceId, QxDimension[]>> = {
|
||||
"social-branding-service": ["SQ"],
|
||||
"qscore-service": ["IQ"],
|
||||
"assessment-service": ["IQ"],
|
||||
"resume-service": ["IQ"],
|
||||
"interview-service": ["EQ"],
|
||||
"roleplay-service": ["EQ", "SQ"],
|
||||
"courses-service": ["IQ"],
|
||||
"matchmaking-service": ["SQ"],
|
||||
"expert-service": ["EQ", "SQ"],
|
||||
"events-service": ["SQ"],
|
||||
};
|
||||
function fallbackQxDimsForService(serviceId: CuratorServiceId): QxDimension[] {
|
||||
if (serviceId === "social-branding-service") return ["SQ"];
|
||||
if (serviceId === "qscore-service" || serviceId === "assessment-service" || serviceId === "resume-service" || serviceId === "courses-service") return ["IQ"];
|
||||
if (serviceId === "interview-service") return ["EQ"];
|
||||
if (serviceId === "roleplay-service" || serviceId === "expert-service") return ["EQ", "SQ"];
|
||||
if (serviceId === "matchmaking-service" || serviceId === "events-service") return ["SQ"];
|
||||
return ["IQ"];
|
||||
}
|
||||
|
||||
type StaticTaskRef = {
|
||||
title: string;
|
||||
@@ -318,7 +314,7 @@ function qxKpiIdForTask(task: StaticTaskRef): number {
|
||||
function qxRawWeightForTask(icpId: CuratorIcpId, task: StaticTaskRef): number {
|
||||
const kpiWeights = qxProfileKpiWeights(qxProfileForIcp(icpId));
|
||||
const kpi = kpiWeights[qxKpiIdForTask(task)];
|
||||
const dims = kpi?.dims.length ? kpi.dims : FALLBACK_DIMS_BY_SERVICE[task.serviceId] ?? ["IQ"];
|
||||
const dims = kpi?.dims.length ? kpi.dims : fallbackQxDimsForService(task.serviceId);
|
||||
return kpi?.weight ?? dims.length;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user