From 711e36f5f57f2a1a8e993ce3d4429629cec0b83f Mon Sep 17 00:00:00 2001 From: nikitosing Date: Mon, 11 Oct 2021 14:36:02 +0300 Subject: [PATCH] Fix comparison of decimal value --- CHANGELOG.md | 1 + .../lib/block_scout_web/templates/block/_tile.html.eex | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d73c0ca4d..015da35105 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - [#4579](https://github.com/blockscout/blockscout/pull/4579) - Write contract page: Resize inputs; Improve multiplier selector ### Fixes +- [#4746](https://github.com/blockscout/blockscout/pull/4746) - Fix comparison of decimal value - [#4711](https://github.com/blockscout/blockscout/pull/4711) - Add trimming to the contract functions inputs - [#4729](https://github.com/blockscout/blockscout/pull/4729) - Fix bugs with fees in cases of txs with `gas price = 0` - [#4725](https://github.com/blockscout/blockscout/pull/4725) - Fix hardcoded coin name on transaction's and block's page diff --git a/apps/block_scout_web/lib/block_scout_web/templates/block/_tile.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/block/_tile.html.eex index f6bf0a3aba..e641f4e6f3 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/block/_tile.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/block/_tile.html.eex @@ -68,7 +68,7 @@
<%= formatted_gas(@block.gas_used) %> - <% gas = if @block.gas_limit > 0, do: Decimal.to_integer(@block.gas_used) / Decimal.to_integer(@block.gas_limit), else: 0 %> + <% gas = if Decimal.cmp(@block.gas_limit, 0) == :gt, do: Decimal.to_integer(@block.gas_used) / Decimal.to_integer(@block.gas_limit), else: 0 %> (<%= formatted_gas(gas, format: "#.#%") %>) <%= gettext "Gas Used" %>