fecgov / openFEC

The first RESTful API for the Federal Election Commission. We're aiming to make campaign finance more accessible for journalists, academics, developers, and other transparency seekers.
https://api.open.fec.gov/developers
Other
481 stars 106 forks source link

Time period incorrect for House special election candidates #2845

Closed PaulClark2 closed 6 years ago

PaulClark2 commented 6 years ago

What we’re after: We should display the correct two-year period (Time period:) for all candidates.

Current state: The two-year period (Time period:) for House special election candidates is incorrect. The Time period: of odd-year special elections should be the election year plus one not election year minus one.

Examples:

Screenshot: image

Completion criteria:

Related issues or PRs: https://github.com/18F/fec-cms/issues/1644 https://github.com/18F/fec-cms/issues/1642 https://github.com/18F/fec-cms/pull/1677

LindsayYoung commented 6 years ago

This is a front end task. We calculate the time period depending on the 2-4-6 aspect of the data. I think we will want to start off the the calculation by getting the end year of the cycle with something like n = n + n % 2

cptechiegal commented 6 years ago

House Candidate: Ossoff https://www.fec.gov/data/candidate/H8GA06195/

However, request seems to prefer the Time Period to be 2017-2018. @PaulClark2 should Time Period display Years based on coverage dates or Election year?

API Candidate Filings endpoint - returns Filings Coverage Start/End dates that are null see API Request: https://api.open.fec.gov/v1/candidate/H8GA06195/filings/?page=1&per_page=20&api_key=DEMO_KEY&sort=-receipt_date

API results: (FEC) Election Years | Candidate Election Years | Cycles election_years | candidate_election_year. | cycles | two_year_period 2017 | 2017 | 2018 | 2018 2017 | 2017 | 2018 | 2018

API testing below indicates that API returns 2017 for elections years and 2018 for cycles. API Testing: https://api.open.fec.gov/developers/#!/candidate/get_candidate_candidate_id_history_cycle

request: https://api.open.fec.gov/v1/candidate/H8GA06195/history/?per_page=20&api_key=DEMO_KEY&sort=-two_year_period&page=1&election_full=false

cptechiegal commented 6 years ago

Same issues for House Candidate: Handel https://www.fec.gov/data/candidate/H8GA06286/

cptechiegal commented 6 years ago

Technical research: The Time Period is handled in the subcycle-select component (GUI template)

Time period: 2016–2017

The Time Period sub cycle component is displayed using the Handlebars templates: electionCycle.hbs and electionCycles.hb The initCycles code in cycle-select.js is where the min and max cycle is determined. The code uses the selected cycle (assuming even year) to setup the min and max cycles For single cycle (house) setting max=selected and min= selected -1 This seems to be coded correctly when input cycle is correct end year.

This is working correctly now, once PR1708 (issue#1644) is released, correcting the issue with the odd value Election year changed to even Election year which ensures the input is the correct end year.

patphongs commented 6 years ago

should be fixed in the next release with this merged PR https://github.com/18F/fec-cms/pull/1708

Closing this issue