Merge pull request #7545 from blockscout/vb-fix-today-price-on-the-chart

Check if cached exchange rate is empty before replacing DB value in stats API
pull/7546/head
Victor Baranov 2 years ago committed by GitHub
commit f38c953bd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 8
      apps/block_scout_web/lib/block_scout_web/controllers/api/v2/stats_controller.ex

@ -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

@ -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

Loading…
Cancel
Save