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

Add coverage dates using API for WCCF feature #3270

Merged
merged 3 commits into from
Oct 17, 2019

Conversation

patphongs
Copy link
Member

@patphongs patphongs commented Oct 15, 2019

Summary

Impacted areas of the application

List general components of the application that this PR will affect:

  • Where contributions come from feature

Screenshots

Screen Shot 2019-10-14 at 9 43 52 PM

How to test

  • npm run build
  • Test to make sure coverage dates update when:
    • Changing candidate name
    • Changing the candidate's election year
    • Test a candidate with no data for a given election year. Make sure the coverage dates are hidden. (ex: presidential candidate Trump running in 1988)

…als endpoint

- Remove no longer needed updateCycleTimeStamp function
@codecov-io
Copy link

Codecov Report

Merging #3270 into develop will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #3270   +/-   ##
========================================
  Coverage    74.54%   74.54%           
========================================
  Files          120      120           
  Lines         7178     7178           
  Branches       633      633           
========================================
  Hits          5351     5351           
  Misses        1827     1827

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 00dd1ef...6cf48e1. Read the comment docs.

Copy link
Contributor

@rfultz rfultz left a comment

Choose a reason for hiding this comment

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

Nice!

.fetch(theFetchUrl, instance.fetchInitObj)
.then(function(response) {
if (response.status !== 200)
throw new Error('The network rejected the states request.');
Copy link
Contributor

Choose a reason for hiding this comment

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

I saw this the other day. I missed all of them. ...could you update the throw new Error messages so they're not all "...rejected the states request"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @rfultz, I've updated the comments for this, can you take a look to see if it's more accurate now?

* Format the dates into MM/DD/YYYY format.
* Pads single digits with leading 0.
*/
ContributionsByState.prototype.formatDate = function(date) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not really good or bad but since this is a pure function and we aren't referencing any particular ContributionsByState instance, we could define this as function formatDate(date) { rather than assign it to the class. But it works fine the way it is.

Copy link
Member Author

Choose a reason for hiding this comment

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

I decided to move the formatDate function to be locally scoped within the loadCandidateCoverageDates function for now since that's the only place it's used. If we need it later on, we can move it back out again.

document
.querySelector('.states-table-timestamp')
.removeAttribute('style');
// Parse coverage date from API that is formatted like this: 2019-06-30T00:00:00+00:00
Copy link
Contributor

Choose a reason for hiding this comment

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

I love comments that explain what we get back from somewhere else

Copy link
Contributor

@rfultz rfultz left a comment

Choose a reason for hiding this comment

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

Woo hoo!

@rfultz rfultz merged commit 45aa96f into develop Oct 17, 2019
@rfultz rfultz deleted the feature/3215-wccf-add-coverage-dates branch October 17, 2019 15:29
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.

Show specific coverage dates for each candidate
3 participants