Recidiviz / justice-counts-components

A set of React components powering a web app for exploring centralized, standardized metrics on the performance of justice systems across the United States
GNU General Public License v3.0
1 stars 0 forks source link

NaN is shown for percentage change when line is hidden #47

Closed colincadams closed 3 years ago

colincadams commented 3 years ago

Describe the bug

If there is data for a line but it is hidden by the time view selector, e.g. data for one line ends more than a year before data for a different line, then the percentage change for that line shows NaN

To Reproduce Steps to reproduce the behavior:

These are the same steps as #46, except with time scale left at "1 year"

  1. Replace src/data.json with https://drive.google.com/file/d/1OLenZP9LW_p3SKX1kA7JahL7n6R-nuxk/view?usp=sharing
  2. Change stateCode to US_CT in src/index.js
  3. Run yarn start
  4. Open the site and scroll to population graph
  5. Notice the probation population percentage is NaN

Expected behavior

@hobuobi mentioned that we should use the "No Data Available" treatment for the given line while it is not in view

Screenshots Screenshots revealing sensitive information must not be shared. If a screenshot is helpful in diagnosing and resolving the bug, please send this directly to a contact on the Recidiviz team.

Screen Shot 2021-02-03 at 3 10 18 PM

Desktop (please complete the following information):

Additional context Add any other context about the problem here.