Compare commits

..

1 Commits

2 changed files with 1 additions and 22 deletions

View File

@ -48,19 +48,6 @@ defmodule Outlook.Translators do
|> Repo.update_all([inc: [our_character_count: billed_characters]])
end
def get_uptodate_deepl_counts(user) do
deepl_counts = Deepl.get_usage_counts(get_deepl_auth_key(user))
our_character_count = deepl_account_for_user(user)
|> select([:our_character_count])
|> Repo.one()
|> Map.get(:our_character_count)
most_accurate = max(our_character_count, deepl_counts.character_count)
%{character_limit: deepl_counts.character_limit,
character_count: deepl_counts.character_count,
our_character_count: our_character_count,
percent_used: most_accurate * 100 / deepl_counts.character_limit}
end
def translate(translation, current_user) do
%{language: target_lang,
article: %{content: article_tree, language: source_lang}
@ -84,14 +71,6 @@ defmodule Outlook.Translators do
process_translation(result.translation, tunit_ids)
end
def update_deepl_counts(user, counts) do
deepl_account_for_user(user)
|> Repo.update_all([set: [
character_limit: counts.character_limit,
character_count: counts.character_count
]])
end
defp deepl_account_for_user(user) when is_struct(user), do: deepl_account_for_user(user.id)
defp deepl_account_for_user(user_id) do
DeeplAccount |> where(user_id: ^user_id)

View File

@ -31,7 +31,7 @@ defmodule OutlookWeb.ArticleLive.NewComponents do
<div>Review Raw InternalTree</div>
<div class="flex">
<div id="html-preview" class="article">
<%= InternalTree.render_html_preview(@raw_internal_tree) |> raw %>
<.render_doc tree={@raw_internal_tree} ></.render_doc>
</div>
<div id="html-tree">
<.render_tree tree={@raw_internal_tree} ></.render_tree>