From d55e4628e9861a80690fb574ccc9f5e20e8216fb Mon Sep 17 00:00:00 2001 From: Yan Guiborat Date: Mon, 23 Jan 2023 11:15:28 +0100 Subject: [PATCH] Using prior value if no new value for a curreny ( fixes #836 ) --- lib/archethic/oracle_chain/services/uco_price.ex | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/archethic/oracle_chain/services/uco_price.ex b/lib/archethic/oracle_chain/services/uco_price.ex index 3f95d26127..34d1ed7638 100644 --- a/lib/archethic/oracle_chain/services/uco_price.ex +++ b/lib/archethic/oracle_chain/services/uco_price.ex @@ -72,7 +72,7 @@ defmodule Archethic.OracleChain.Services.UCOPrice do previous_values ++ values end) - {_currency, _values}, acc -> + _, acc -> acc end) end @@ -87,7 +87,10 @@ defmodule Archethic.OracleChain.Services.UCOPrice do {:ok, prices_now} -> Enum.all?(@pairs, fn pair -> - compare_price(Map.fetch!(prices_prior, pair), Map.fetch!(prices_now, pair)) + compare_price( + Map.fetch!(prices_prior, pair), + Map.get(prices_now, pair, Map.fetch!(prices_prior, pair)) + ) end) end end