We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
percentage
1 parent 348e70e commit 3523b59Copy full SHA for 3523b59
1 file changed
extra/lib/plausible/stats/funnel.ex
@@ -168,11 +168,7 @@ defmodule Plausible.Stats.Funnel do
168
|> Enum.reverse()
169
end
170
171
- defp percentage(x, y) when x in [0, nil] or y in [0, nil] do
172
- "0"
173
- end
174
-
175
- defp percentage(x, y) do
+ defp percentage(x, y) when is_integer(x) and x > 0 and is_integer(y) and y > 0 do
176
result =
177
x
178
|> Decimal.div(y)
@@ -187,4 +183,8 @@ defmodule Plausible.Stats.Funnel do
187
183
decimal -> decimal
188
184
189
185
186
+
+ defp percentage(_x, _y) do
+ "0"
+ end
190
0 commit comments