From 339c91e390c8602f6bc02bda09437db796958274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Vila=C3=A7a?= Date: Fri, 29 Jan 2021 23:39:33 +0000 Subject: [PATCH] Add link tweaks (#101) --- Dockerfile | 2 ++ lib/infin/importer.ex | 7 +++++-- lib/infin/invoices.ex | 1 + lib/infin_web/controllers/user_auth.ex | 2 +- lib/infin_web/templates/layout/_navbar.html.eex | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0fb72c9..702cdeb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,8 @@ RUN cd assets/ && \ cd - && \ mix do compile, phx.digest +RUN chmod -R a+rw /opt/app + USER default ENTRYPOINT ["/opt/app/docker-entrypoint.sh"] diff --git a/lib/infin/importer.ex b/lib/infin/importer.ex index f772c3a..aaa79f0 100644 --- a/lib/infin/importer.ex +++ b/lib/infin/importer.ex @@ -37,7 +37,8 @@ defmodule Infin.Importer do Application.get_env(:infin, InfinWeb.Endpoint)[:pt_invoices_url] <> "/invoices", {:stream, enumerable}, - headers + headers, + [timeout: 15_000] ) do {:ok, response} -> case response.status_code do @@ -97,7 +98,9 @@ defmodule Infin.Importer do Neuron.Config.set(url: analytics_url) Neuron.query( - "{ categorize_invoices(invoices: \"{\\\"list\\\": #{parsed_invoices}}\")}" + "{ categorize_invoices(invoices: \"{\\\"list\\\": #{parsed_invoices}}\")}", + %{}, + connection_opts: [recv_timeout: 15_000] ) end diff --git a/lib/infin/invoices.ex b/lib/infin/invoices.ex index 8686ba4..beb2e3e 100644 --- a/lib/infin/invoices.ex +++ b/lib/infin/invoices.ex @@ -65,6 +65,7 @@ defmodule Infin.Invoices do |> where(company_id: ^company_id) |> join(:left, [i], ti in InvoiceTransaction, on: i.id == ti.invoice_id) |> where([i, ti], is_nil(ti.invoice_id)) + |> order_by([i], [desc: i.doc_emission_date]) |> preload([:company_seller]) |> Repo.paginate(page: page_number) end diff --git a/lib/infin_web/controllers/user_auth.ex b/lib/infin_web/controllers/user_auth.ex index 9418d4d..e12676e 100644 --- a/lib/infin_web/controllers/user_auth.ex +++ b/lib/infin_web/controllers/user_auth.ex @@ -81,7 +81,7 @@ defmodule InfinWeb.UserAuth do conn |> renew_session() |> delete_resp_cookie(@remember_me_cookie) - |> redirect(to: Routes.home_path(conn, :index)) + |> redirect(to: "/") end @doc """ diff --git a/lib/infin_web/templates/layout/_navbar.html.eex b/lib/infin_web/templates/layout/_navbar.html.eex index f6d65eb..2e51076 100644 --- a/lib/infin_web/templates/layout/_navbar.html.eex +++ b/lib/infin_web/templates/layout/_navbar.html.eex @@ -4,7 +4,7 @@