From 49d77fc0326e82d50d5283ab9c1e6f643c933adb Mon Sep 17 00:00:00 2001 From: Thelonius Kort Date: Thu, 19 Jan 2023 14:02:53 +0100 Subject: [PATCH] Fix issue with additional status that has been observed --- lib/outlook/translators/deepl.ex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/outlook/translators/deepl.ex b/lib/outlook/translators/deepl.ex index b94c7f8..6223405 100644 --- a/lib/outlook/translators/deepl.ex +++ b/lib/outlook/translators/deepl.ex @@ -55,15 +55,15 @@ defmodule Outlook.Translators.Deepl do response = Jason.decode!(response_raw.body, keys: :atoms) case response do - %{status: "translating"} -> + %{status: "done"} -> + response + %{status: status} -> steps = response.seconds_remaining * 5 for n <- 0..steps do - send(pid, {:progress, %{progress: 100 * n / steps}}) + send(pid, {:progress, %{progress: 100 * n / steps, status: status}}) Process.sleep 200 end check_status(pid, credentials) - %{status: "done"} -> - response end end