@dra2020/district-analytics 6.3.0 → 6.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +22 -5
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -89876,7 +89876,10 @@ function weightPartisan(bS, iS, cS, context) {
|
|
|
89876
89876
|
}
|
|
89877
89877
|
exports.weightPartisan = weightPartisan;
|
|
89878
89878
|
function extraBonus(Vf) {
|
|
89879
|
-
|
|
89879
|
+
// PROPORTIONALITY - 06/24/2020 - Making the OK extra amount always positive.
|
|
89880
|
+
// const okExtra: number = (0.5 - Vf) * (C.winnerBonus() - 1.0);
|
|
89881
|
+
const over50Pct = (Vf > 0.5) ? (Vf - 0.5) : (0.5 - Vf);
|
|
89882
|
+
const okExtra = over50Pct * (C.winnerBonus() - 1.0);
|
|
89880
89883
|
return U.trim(okExtra);
|
|
89881
89884
|
}
|
|
89882
89885
|
exports.extraBonus = extraBonus;
|
|
@@ -89902,12 +89905,26 @@ function scorebias(rawBias, Vf, Sf) {
|
|
|
89902
89905
|
}
|
|
89903
89906
|
}
|
|
89904
89907
|
exports.scorebias = scorebias;
|
|
89908
|
+
// PROPORTIONALITY - 06/24/2020
|
|
89905
89909
|
// Adjust bias to account for a winner's bonus
|
|
89910
|
+
// * If the bias is in the *same* direction as the statewide vote %, then
|
|
89911
|
+
// discount the bias by the winner's bonus (extra).
|
|
89912
|
+
// * But if the bias and statewide vote % go in opposite directions, leave the
|
|
89913
|
+
// bias unadjusted.
|
|
89906
89914
|
function adjustBias(Vf, bias, extra) {
|
|
89907
|
-
|
|
89908
|
-
|
|
89909
|
-
|
|
89910
|
-
|
|
89915
|
+
let adjusted = bias;
|
|
89916
|
+
if ((Vf > 0.5) && (bias < 0)) {
|
|
89917
|
+
adjusted = Math.min(bias + extra, 0);
|
|
89918
|
+
}
|
|
89919
|
+
else if ((Vf < 0.5) && (bias > 0)) {
|
|
89920
|
+
adjusted = Math.max(bias - extra, 0);
|
|
89921
|
+
}
|
|
89922
|
+
return adjusted;
|
|
89923
|
+
// PROPORTIONALITY - 06/24/2020 - Original logic:
|
|
89924
|
+
// if (Vf > 0.5)
|
|
89925
|
+
// return Math.min(bias + extra, 0);
|
|
89926
|
+
// else
|
|
89927
|
+
// return Math.max(bias - extra, 0);
|
|
89911
89928
|
}
|
|
89912
89929
|
exports.adjustBias = adjustBias;
|
|
89913
89930
|
// Normalize unearned seats
|