@dra2020/district-analytics 7.1.6 → 7.1.7

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.
@@ -693,6 +693,8 @@ class Features {
693
693
  this._session = s;
694
694
  this._data = data;
695
695
  this._keys = keys;
696
+ // For debugging PVI
697
+ // console.log("Election dataset =", this._keys[Dataset.ELECTION]);
696
698
  }
697
699
  nFeatures() { return this._data.features.length; }
698
700
  featureByIndex(i) { return this._data.features[i]; }
@@ -703,8 +705,15 @@ class Features {
703
705
  return value;
704
706
  }
705
707
  fieldForFeature(f, dt, fk) {
706
- let dk = this._keys[dt];
707
- return _getFeatures(f, dk, fk);
708
+ const dk = this._keys[dt];
709
+ let result = undefined;
710
+ // 07-31-2020 - Fix to post-process PVI into the expected election composite format.
711
+ if (dk === 'P16GPR') {
712
+ result = (_getFeatures(f, dk, (fk === 'D' ? 'D12' : 'R12')) + _getFeatures(f, dk, (fk === 'D' ? 'D16' : 'R16'))) / 2;
713
+ }
714
+ else
715
+ result = _getFeatures(f, dk, fk);
716
+ return result;
708
717
  }
709
718
  resetDataset(d, k) {
710
719
  this._keys[d] = k;