Skip to content

Commit

Permalink
Merge pull request #12605 from woocommerce/issue/12548-attempt-fix-st…
Browse files Browse the repository at this point in the history
…ats-crash

An attempt to fix a crash in the Dashboard Performance card
  • Loading branch information
hichamboushaba authored Sep 18, 2024
2 parents c5b2d08 + 40b4638 commit 6ea261b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ class DashboardStatsView @JvmOverloads constructor(
fadeInLabelValue(ordersValue, orders)

if (chartRevenueStats.isEmpty() || revenueStatsModel?.totalSales == 0.toDouble()) {
binding.chart.clear()
isRequestingStats = false
return
}
Expand Down Expand Up @@ -648,8 +649,7 @@ class DashboardStatsView @JvmOverloads constructor(
}

private fun generateLineDataSet(revenueStats: Map<String, Double>): LineDataSet {
chartRevenueStats = revenueStats
val entries = chartRevenueStats.values.mapIndexed { index, value ->
val entries = revenueStats.values.mapIndexed { index, value ->
Entry((index + 1).toFloat(), value.toFloat())
}
return LineDataSet(entries, "")
Expand Down

0 comments on commit 6ea261b

Please sign in to comment.