Merge pull request #4768 from blockscout/np-handle-zero-division

Block Details page: Handle zero division
pull/4776/head
Victor Baranov 3 years ago committed by GitHub
commit dcc613949b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 2
      apps/block_scout_web/lib/block_scout_web/templates/block/overview.html.eex

@ -20,6 +20,7 @@
- [#4579](https://github.com/blockscout/blockscout/pull/4579) - Write contract page: Resize inputs; Improve multiplier selector - [#4579](https://github.com/blockscout/blockscout/pull/4579) - Write contract page: Resize inputs; Improve multiplier selector
### Fixes ### Fixes
- [#4768](https://github.com/blockscout/blockscout/pull/4768) - Block Details page: handle zero division
- [#4751](https://github.com/blockscout/blockscout/pull/4751) - Change text and link for `trade STAKE` button - [#4751](https://github.com/blockscout/blockscout/pull/4751) - Change text and link for `trade STAKE` button
- [#4746](https://github.com/blockscout/blockscout/pull/4746) - Fix comparison of decimal value - [#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 - [#4711](https://github.com/blockscout/blockscout/pull/4711) - Add trimming to the contract functions inputs

@ -171,7 +171,7 @@
text: gettext("The total gas amount used in the block and its percentage of gas filled in the block.") %> text: gettext("The total gas amount used in the block and its percentage of gas filled in the block.") %>
<%= gettext("Gas Used") %> <%= gettext("Gas Used") %>
</dt> </dt>
<dd class="col-sm-9 col-lg-10"><%= @block.gas_used |> BlockScoutWeb.Cldr.Number.to_string! %> | <%= (Decimal.to_integer(@block.gas_used) / Decimal.to_integer(@block.gas_limit)) |> BlockScoutWeb.Cldr.Number.to_string!(format: "#.#%") %></dd> <dd class="col-sm-9 col-lg-10"><%= @block.gas_used |> BlockScoutWeb.Cldr.Number.to_string! %> | <%= if Decimal.cmp(@block.gas_limit, 0) == :eq, do: "0%", else: ((Decimal.to_integer(@block.gas_used) / Decimal.to_integer(@block.gas_limit)) |> BlockScoutWeb.Cldr.Number.to_string!(format: "#.#%")) %></dd>
</dl> </dl>
<!-- Gas Limit --> <!-- Gas Limit -->
<dl class="row"> <dl class="row">

Loading…
Cancel
Save