@dra2020/district-analytics 8.2.6 → 8.2.9

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.
@@ -1317,8 +1317,12 @@ function doHasEqualPopulations(s, bLog = false) {
1317
1317
  let popDevTest = s.getTest(4 /* PopulationDeviation */);
1318
1318
  const popDevPct = popDevTest['score'];
1319
1319
  const popDevNormalized = popDevTest['normalizedScore'];
1320
+ // 09-19-2020 - Added to catch edge case of only one non-empty district
1321
+ const p = s._profile;
1322
+ const totPopByDistrict = p.populationProfile.totalPopByDistrict.filter(x => x > 0);
1323
+ const bTwoOrMoreDistricts = (totPopByDistrict.length > 1) ? true : false;
1320
1324
  // Populate the test entry
1321
- if (popDevNormalized > 0) {
1325
+ if (bTwoOrMoreDistricts && (popDevNormalized > 0)) {
1322
1326
  test['score'] = true;
1323
1327
  }
1324
1328
  else {
@@ -2016,9 +2020,16 @@ function scorePlan(s, p, bLog = false, overridesJSON) {
2016
2020
  // Add minority notes
2017
2021
  scorecard.minority.details['majorityMinority'] = M.getMajorityMinority(s);
2018
2022
  scorecard.minority.details['vraPreclearance'] = M.getVRASection5(s);
2019
- // Add KIWYSI compactness score
2020
- const kiwysiScore = C.scoreKIWYSICompactness(s, bLog);
2021
- scorecard.compactness.details['kiwysi'] = kiwysiScore;
2023
+ try {
2024
+ // Add KIWYSI compactness score
2025
+ const kiwysiScore = C.scoreKIWYSICompactness(s, bLog);
2026
+ scorecard.compactness.details['kiwysi'] = kiwysiScore;
2027
+ }
2028
+ catch (e) {
2029
+ console.log("Exception caught scoring KIWYSI compactness.");
2030
+ console.log(e.message);
2031
+ // throw e;
2032
+ }
2022
2033
  return scorecard;
2023
2034
  }
2024
2035
  exports.scorePlan = scorePlan;