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

5215 house and senate overview totals #5443

Merged
merged 23 commits into from
Dec 6, 2022

Conversation

rfultz
Copy link
Contributor

@rfultz rfultz commented Oct 17, 2022

Summary

Quite a few changes to /data/elections/house/ and /data/elections/senate/

Required reviewers

Front-end and UX?

Impacted areas of the application

The House & Senate overview pages

Screenshots

Before:
image

This PR:
image

Related PRs

None

Known TODOs

  • Look & feel of the summary section (and maybe the others)
  • Initial data and load appearance/content
  • Values and formulas verification (Paul?)
  • Layouts for the in-between sizes
  • Organization of the rest of the page—section titles, tab organization, flags
  • Specific TODOs in the code—features, etc
  • Clean up the fetch URL, specifically add the api_key
  • Testing w/ non-Chromium browsers

How to test

  • pull the branch
  • npm i
  • npm run build
  • ./manage.py runserver
  • House elections page
    • initial load works?
    • changing the election year pull-down works?
    • changing tabs works?
    • changing tabs or years, copy the URL, paste it back in. Does it work as expected?
    • are the other tabs' content broken?
  • Senate elections page
    • initial load works?
    • changing the election year pull-down works?
    • changing tabs works?
    • changing tabs or years, copy the URL, paste it back in. Does it work as expected?
    • are the other tabs' content broken?

Copy link
Member

@patphongs patphongs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed that the query statements should be tweaked slightly to display the correct totals.

theURL += `&election_year=${electionYear}&office=${window.context.office_code}&api_key=`;

fetch(
`${theURL}&aggregate_by=office`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that this is concatenating two aggregate_by parameters into the same call. But you can only pass one in a single call. The total raised, spent, and cash on hand dollar figures should be coming from a call that passes aggregate_by=office. The party breakdown for raised, spent, and cash on hand should be coming from a call that passes aggregate_by=office-party.

The dollar figures in this feature should match the dollar figures that we have in the summary raising by the numbers and summary spending by the numbers pages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh, good catch!
Aggregate totals is using /candidates/totals/by_office/ and …by_party/
but the ticket attached to this says to use /candidates/totals/aggregates/.

Should they be using different endpoints?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually /candidates/totals/by_office/ and /candidates/totals/by_party/ will be deprecated since we found a better and cleaner way to do the totals with the /candidates/totals/aggregates/ endpoint. I'll file a ticket for that later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I look at the values coming back from those endpoints, the values aren't the same. Looking specifically at S, 2020, Dem, total receipts,

/candidates/totals/by_office/by_party/?election_full=true&election_year=2020&sort_hide_null=false&sort_null_only=false&per_page=20&sort_nulls_last=false&office=S&page=1&api_key=
returns 1245650818.65

/candidates/totals/aggregates/?election_full=true&is_active_candidate=true&per_page=10&aggregate_by=office-party&election_year=2020&office=S&api_key=
returns 1238433907.94

Comment on lines 122 to 140
// Let's do some math to get real total_contributions
usefulResults.total_contributions = {
total:
usefulResults.total_individual_itemized_contributions.total
+ usefulResults.total_other_political_committee_contributions.total
+ usefulResults.total_transfers_from_other_authorized_committee.total,
DEM:
usefulResults.total_individual_itemized_contributions.DEM
+ usefulResults.total_other_political_committee_contributions.DEM
+ usefulResults.total_transfers_from_other_authorized_committee.DEM,
REP:
usefulResults.total_individual_itemized_contributions.REP
+ usefulResults.total_other_political_committee_contributions.REP
+ usefulResults.total_transfers_from_other_authorized_committee.REP,
Other:
usefulResults.total_individual_itemized_contributions.Other
+ usefulResults.total_other_political_committee_contributions.Other
+ usefulResults.total_transfers_from_other_authorized_committee.Other
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rfultz The total raised should actually be total_receipts and not the aggregate of all of these put together. This is the discrepancy we're seeing in the raising data.

@codecov-commenter
Copy link

codecov-commenter commented Nov 17, 2022

Codecov Report

Merging #5443 (226f52f) into develop (86d1349) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop    #5443      +/-   ##
===========================================
+ Coverage    75.16%   75.18%   +0.01%     
===========================================
  Files          125      125              
  Lines         8123     8123              
  Branches       648      649       +1     
===========================================
+ Hits          6106     6107       +1     
+ Misses        2017     2016       -1     
Impacted Files Coverage Δ
fec/fec/static/js/modules/helpers.js 51.37% <100.00%> (ø)
fec/fec/static/js/modules/calendar.js 92.80% <0.00%> (+0.71%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

<figure class="js-party-money-bars" id="summary-total-raised" data-event-field-id="total_receipts">
<div class="total-wrapper">
<h1 class="value js-value-large">$1,234,567,890</h1>
<h2 class="description js-value-large-desc">raised by {{ office | title }} candidates</h2>
Copy link
Contributor

@JonellaCulmer JonellaCulmer Nov 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can drop "House" from these so that the cash on hand one doesn't wrap. As in "raised by House candidates" "spent by House candidates" and "cash on hand for House candidates"

@JonellaCulmer
Copy link
Contributor

@rfultz Great work!!! Just a few odds and ends:

  1. Need a bit more breathing room between section headers and edit the language in the Senate/House button. Harder to distinguish between the different sections currently.

Screen Shot 2022-11-17 at 12 06 28 PM

Example on [H4CC page](https://www.fec.gov/help-candidates-and-committees/candidate-taking-receipts/who-can-and-cant-contribute/).
  1. Dem blocks are still red on load or refresh.

  2. Adjust intro text on election summary feature to say: "Comparing total money raised, spent and cash on hand, by party." (Since we removed "remaining" from the cash on hand section)

  3. Can we tighten up the space between the bottom line and the bottom help text and methodology button?
    Before

Screen Shot 2022-11-18 at 2 47 29 PM

After (As seen on Raising browse data page):
Screen Shot 2022-11-18 at 2 45 57 PM

  1. Should we open a separate ticket for this? There are weird blocks appearing at the bottom of House candidate contributions over time and totals for all House elections features. And no padding between text and methodology button

Screen Shot 2022-11-17 at 12 05 45 PM

Copy link
Member

@patphongs patphongs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rfultz, looks good now

@patphongs patphongs merged commit 25349ea into develop Dec 6, 2022
@rfultz rfultz deleted the feature/5215-house-and-senate-overview-totals branch July 22, 2024 15:20
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.

Build out House and Senate overview totals feature
4 participants