fix PGRange to Block.Range conversion

pull/2499/head
Ayrat Badykov 5 years ago
parent 3fa6ed67c3
commit 40e6fd76ca
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 2
      apps/explorer/lib/explorer/chain/block/range.ex

@ -136,10 +136,12 @@ defmodule Explorer.Chain.Block.Range do
def load(_), do: :error def load(_), do: :error
defp parse_upper(%PGRange{upper: :unbound}), do: :infinity
defp parse_upper(%PGRange{upper: nil}), do: :infinity defp parse_upper(%PGRange{upper: nil}), do: :infinity
defp parse_upper(%PGRange{upper: upper, upper_inclusive: true}), do: upper defp parse_upper(%PGRange{upper: upper, upper_inclusive: true}), do: upper
defp parse_upper(%PGRange{upper: upper, upper_inclusive: false}), do: upper - 1 defp parse_upper(%PGRange{upper: upper, upper_inclusive: false}), do: upper - 1
defp parse_upper(%PGRange{lower: :unbound}), do: :negative_infinity
defp parse_lower(%PGRange{lower: nil}), do: :negative_infinity defp parse_lower(%PGRange{lower: nil}), do: :negative_infinity
defp parse_lower(%PGRange{lower: lower, lower_inclusive: true}), do: lower defp parse_lower(%PGRange{lower: lower, lower_inclusive: true}), do: lower
defp parse_lower(%PGRange{lower: lower, lower_inclusive: false}), do: lower + 1 defp parse_lower(%PGRange{lower: lower, lower_inclusive: false}), do: lower + 1

Loading…
Cancel
Save