|
@@ -28,7 +28,8 @@ var ScoreCalculator = function() {
|
|
|
weight = profile.categories[categoryName].policies[policyName];
|
|
|
|
|
|
if (data.rules[policyName]) {
|
|
|
- sum += data.rules[policyName].score * weight;
|
|
|
+ var policyScore = data.rules[policyName].score + data.rules[policyName].abnormalityScore;
|
|
|
+ sum += policyScore * weight;
|
|
|
} else {
|
|
|
// Max value if rule is not here
|
|
|
sum += 100 * weight;
|
|
@@ -42,7 +43,7 @@ var ScoreCalculator = function() {
|
|
|
if (totalWeight === 0) {
|
|
|
categoryResult.categoryScore = 100;
|
|
|
} else {
|
|
|
- categoryResult.categoryScore = Math.round(sum / totalWeight);
|
|
|
+ categoryResult.categoryScore = Math.round(Math.max(sum, 0) / totalWeight);
|
|
|
}
|
|
|
|
|
|
categoryResult.rules = rules;
|