Skip to content

Commit

Permalink
[bugfix] More graceful handling of negative deltas in the data for so…
Browse files Browse the repository at this point in the history
…me states, e.g. D.C on May 24
  • Loading branch information
Rahul Pandey committed Jul 9, 2020
1 parent 0c373f5 commit 9f8a0b7
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,18 @@ class MainActivity : AppCompatActivity() {
return
}

perStateDailyData = statesData.filter { it.dateChecked != null }.reversed().groupBy { it.state }
perStateDailyData = statesData
.filter { it.dateChecked != null }
.map { // State data may have negative deltas, which don't make sense to graph
CovidData(
it.dateChecked,
it.positiveIncrease.coerceAtLeast(0),
it.negativeIncrease.coerceAtLeast(0),
it.deathIncrease.coerceAtLeast(0),
it.state
) }
.reversed()
.groupBy { it.state }
Log.i(TAG, "Update spinner with state names")
updateSpinnerWithStateData(perStateDailyData.keys)
}
Expand Down

0 comments on commit 9f8a0b7

Please sign in to comment.