fix(report): cap dimension scores and match zoom crops to thumbnails
This commit is contained in:
+4
-2
@@ -63,6 +63,7 @@
|
||||
}
|
||||
function round2(x) { return Math.round((x + 1e-9) * 100) / 100; } // 1e-9 修正 9.445 类浮点
|
||||
function sRaw(P) { return 7 + 3 * P / 100; }
|
||||
function capDimensionScore(S) { return isNum(S) ? Math.min(9.9, S) : null; }
|
||||
// One shared 100-point total for H5, saved reports and admin. Never use the
|
||||
// upstream total or reweight an incomplete set of dimensions.
|
||||
function weightedTotal(dims) {
|
||||
@@ -71,7 +72,7 @@
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var score = dims[keys[i]] && dims[keys[i]].S;
|
||||
if (!isNum(score) || score < 0 || score > 10) return null;
|
||||
total += score * weights[i];
|
||||
total += capDimensionScore(score) * weights[i];
|
||||
}
|
||||
return Math.round(total + 1e-9);
|
||||
}
|
||||
@@ -757,7 +758,7 @@
|
||||
}
|
||||
var dP = ps.length ? Math.min.apply(null, ps) : null;
|
||||
if (!ps.length) notes.push(d.name + ':旗下分类数据全部缺失,维度不参与评分');
|
||||
dims[d.key] = { name: d.name, P: dP, S: sShow(dP), level: levelOf(dP) };
|
||||
dims[d.key] = { name: d.name, P: dP, S: capDimensionScore(sShow(dP)), level: levelOf(dP) };
|
||||
}
|
||||
|
||||
// 均分(判档用未四舍五入原值)与最差分类(并列按 CAT_DEFS 顺序取前者)
|
||||
@@ -942,6 +943,7 @@
|
||||
return Math.max(actual - 5, Math.min(actual + 5, raw));
|
||||
}
|
||||
return {
|
||||
capDimensionScore: capDimensionScore,
|
||||
weightedTotal: weightedTotal,
|
||||
reportSkinAge: reportSkinAge,
|
||||
buildViewModel: buildViewModel,
|
||||
|
||||
Reference in New Issue
Block a user