diff options
author | Guillermo Ramos | 2020-02-13 11:44:49 +0100 |
---|---|---|
committer | Guillermo Ramos | 2020-02-13 11:44:49 +0100 |
commit | 4c3477a3691a8f172bba8c240ab3b43cc34f542e (patch) | |
tree | bfa4d46b2e33a367216eb1d551477864ef555def | |
parent | 1392df6e6d89dc1922a80722941060a1431f685b (diff) | |
download | waev-4c3477a3691a8f172bba8c240ab3b43cc34f542e.tar.gz |
Fix pagination with multiline messages
-rw-r--r-- | lib/waev/export.ex | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/waev/export.ex b/lib/waev/export.ex index 999bb61..2fd80f5 100644 --- a/lib/waev/export.ex +++ b/lib/waev/export.ex @@ -69,8 +69,6 @@ defmodule Waev.Export do true -> e = File.stream!(chat_path(e_id)) - |> Enum.drop((page - 1) * size) - |> Enum.take(size) |> Enum.reduce(%Waev.Export{id: e_id}, fn line, e -> line = String.trim(line) @@ -126,7 +124,15 @@ defmodule Waev.Export do end end) - {:ok, %{e | messages: Enum.reverse(e.messages)}} + {:ok, + %{ + e + | messages: + e.messages + |> Enum.reverse() + |> Enum.drop((page - 1) * size) + |> Enum.take(size) + }} false -> :error |