act-now-coalition / covid-data-model

Data backend providing computed data for the graphs displayed at https://covidactnow.org
https://covidactnow.org/
MIT License
149 stars 57 forks source link

Don't remove trailing zeros on an all-zero series #1215

Closed smcclure17 closed 2 years ago

smcclure17 commented 2 years ago

If the timeseries is all zeros then last_nonzero_index is None, causing the comparison on line 164 to fail.

This change means that we will never truncate the trailing zeros for an all-zero series (even if the series is shorter than stall_length)

this addresses the sentry error: https://sentry.io/organizations/covidactnow/issues/2907283165/?environment=Environment.PRODUCTION&project=5203044&referrer=alert_email