From ad4b6b6af6a23950cbcd6cd4ae92889714c34f3c Mon Sep 17 00:00:00 2001 From: "bl@ckode" Date: Thu, 31 Mar 2022 10:09:03 +0530 Subject: [PATCH] Fix Credo errors --- lib/archethic/utils.ex | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/archethic/utils.ex b/lib/archethic/utils.ex index 61b875ad9..8534c8aee 100644 --- a/lib/archethic/utils.ex +++ b/lib/archethic/utils.ex @@ -620,6 +620,12 @@ defmodule ArchEthic.Utils do iex> ArchEthic.Utils.seconds_to_human_readable(3666) "1 hour 01 minute 06 second" + + iex> ArchEthic.Utils.seconds_to_human_readable(66) + "1 minute 06 second" + + iex> ArchEthic.Utils.seconds_to_human_readable(6) + "0 minute 06 second" """ def seconds_to_human_readable(0), do: "00:00:00" @@ -632,7 +638,7 @@ defmodule ArchEthic.Utils do |> elem(0) |> Enum.drop_while(&match?(0, &1)) - {h, t} = if length(t) == 0, do: {0, [h]}, else: {h, t} + {h, t} = if t == [], do: {0, [h]}, else: {h, t} base_unit = if length(t) > 1, do: "hour", else: "minute"