diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e1dc39a66..b59bed5198 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Fixes +- [#7545](https://github.com/blockscout/blockscout/pull/7545) - Check if cached exchange rate is empty before replacing DB value in stats API - [#7516](https://github.com/blockscout/blockscout/pull/7516) - Fix shrinking logo in Safari ### Chore diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/stats_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/stats_controller.ex index 20c93f33bb..5707d1b15f 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/stats_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/stats_controller.ex @@ -99,7 +99,13 @@ defmodule BlockScoutWeb.API.V2.StatsController do recent_market_history |> case do [today | the_rest] -> - [%{today | closing_price: exchange_rate.usd_value} | the_rest] + [ + %{ + today + | closing_price: if(exchange_rate.usd_value, do: exchange_rate.usd_value, else: today.closing_price) + } + | the_rest + ] data -> data