From bf0b5448b6aadd2a6a9f65da1fcb45f75883bb3c Mon Sep 17 00:00:00 2001 From: Raymonzut <40148684+Raymonzut@users.noreply.github.com> Date: Thu, 12 Nov 2020 17:36:40 +0100 Subject: [PATCH] Fix #13 --- client/gen.exs | 1 + 1 file changed, 1 insertion(+) diff --git a/client/gen.exs b/client/gen.exs index 0a853f6..c1ab456 100644 --- a/client/gen.exs +++ b/client/gen.exs @@ -35,6 +35,7 @@ post_contents = File.ls!("./posts") months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] index_file = post_contents |> Enum.sort_by(fn m -> Map.get(m, :date) |> (fn d -> Enum.find_index(months, &(&1 == String.slice(d, 8..10))) end).() end) + |> Enum.reverse() # Group by month |> Enum.group_by(fn m -> Map.get(m, :date) |> String.slice(8..15) end) |> Enum.sort_by(fn {d, _c} -> (length months) * elem(Integer.parse(String.slice(d, 4..7)), 0)