Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add precincts reporting percent override #52

Merged
merged 7 commits into from
Dec 4, 2022

Conversation

chriszs
Copy link
Contributor

@chriszs chriszs commented Dec 4, 2022

Description

This PR adds an override to allow specifying a reporting status for precincts in a specific county. To use, you add --precinctsReportingPct='{"bacon":0}', specifying the county IDs and reporting percents, to the CLI. This sets all the subunits to the same reporting percent, as well as overall result, so the above example will set all subunits in Bacon county to 0 as well as the overall percent for Bacon county itself.

Jira Ticket

ELEX-1959

Test Steps

tox
elexclarity 115470 GA --level=precinct --officeID=P --countyName=Bacon --voteCompletionMode=combined --precinctsReportingPct='{"bacon":0}' --filename="tests/fixtures/results/ga_bacon_precincts_11-3.xml"

After

{
  "2020-11-03_GA_G_P_bacon": {
    "id": "2020-11-03_GA_G_P_bacon",
    "source": "clarity",
    "precinctsReportingPct": 0,
    "counts": {
      "2020-11-03_GA_G_P_bacon_donald_j_trump_i_rep": 4018,
      "2020-11-03_GA_G_P_bacon_joseph_r_biden_dem": 625,
      "2020-11-03_GA_G_P_bacon_jo_jorgensen_lib": 25
    },
    "office": "P",
    "lastUpdated": "2020-11-05T16:39:44Z",
    "subunits": {
      "bacon_douglas": {
        "id": "bacon_douglas",
        "counts": {
          "2020-11-03_GA_G_P_bacon_donald_j_trump_i_rep": 4018,
          "2020-11-03_GA_G_P_bacon_joseph_r_biden_dem": 625,
          "2020-11-03_GA_G_P_bacon_jo_jorgensen_lib": 25
        },
        // ...
        "precinctsReportingPct": 0
      }
    }
  }
}

Before

{
  "2020-11-03_GA_G_P_bacon": {
    "id": "2020-11-03_GA_G_P_bacon",
    "source": "clarity",
    "precinctsReportingPct": 100.0,
    "counts": {
      "2020-11-03_GA_G_P_bacon_donald_j_trump_i_rep": 4018,
      "2020-11-03_GA_G_P_bacon_joseph_r_biden_dem": 625,
      "2020-11-03_GA_G_P_bacon_jo_jorgensen_lib": 25
    },
    "office": "P",
    "lastUpdated": "2020-11-05T16:39:44Z",
    "subunits": {
      "bacon_douglas": {
        "id": "bacon_douglas",
        "counts": {
          "2020-11-03_GA_G_P_bacon_donald_j_trump_i_rep": 4018,
          "2020-11-03_GA_G_P_bacon_joseph_r_biden_dem": 625,
          "2020-11-03_GA_G_P_bacon_jo_jorgensen_lib": 25
        },
        // ...
        "precinctsReportingPct": 100,
        "expectedVotes": 4668
      }
    }
  }
}

@chriszs chriszs changed the title feat: add precincts reporting pct override feat: add precincts reporting percent override Dec 4, 2022
@lennybronner
Copy link
Contributor

why does the test use a fixture and not an actual page? also, can we add a unit test for this?

@chriszs
Copy link
Contributor Author

chriszs commented Dec 4, 2022

@lennybronner No particular reason, it's just better to use a fixture than have your test hit a live API. Yes, we can add a unit test using that same fixture.

@chriszs
Copy link
Contributor Author

chriszs commented Dec 4, 2022

Unit test added.

@lennybronner
Copy link
Contributor

Why does expected votes go away when we override?

@chriszs
Copy link
Contributor Author

chriszs commented Dec 4, 2022

@lennybronner Expected votes only appears when the precinct is fully reporting. It is set to the turnout.

@chriszs chriszs merged commit 0418f4c into develop Dec 4, 2022
@chriszs chriszs deleted the feat/add-precincts-reporting-pct-override branch December 4, 2022 22:33
@chriszs chriszs mentioned this pull request Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants