From c04f34083f708411201b94b17310045f538e11f5 Mon Sep 17 00:00:00 2001 From: Rhiannon Morris Date: Mon, 21 Sep 2020 21:44:54 +0200 Subject: [PATCH] use year of latest update on gallery page --- make-pages/GalleryPage.hs | 2 +- make-pages/Info.hs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/make-pages/GalleryPage.hs b/make-pages/GalleryPage.hs index d60acf7..be5be76 100644 --- a/make-pages/GalleryPage.hs +++ b/make-pages/GalleryPage.hs @@ -85,7 +85,7 @@ make' root (GalleryInfo {title, desc, prefix, filters, hidden}) infos = [b|@0 [(the year, infopath) | infopath@(_, info) <- infos, then sortOn by Down info, - let year = #year info, + let year = #latestYear info, then group by Down year using groupBy'] groupBy' f = groupBy ((==) `on` f) diff --git a/make-pages/Info.hs b/make-pages/Info.hs index 59349ae..0020fff 100644 --- a/make-pages/Info.hs +++ b/make-pages/Info.hs @@ -114,6 +114,10 @@ instance HasField "day" Info Int where getField = #third . #dmy instance HasField "latestDate" Info Day where getField (Info {date, updates}) = maximum (date : Map.keys updates) +instance HasField "latestYear" Info Integer where + getField = #first . toGregorian . #latestDate + + instance HasField "updated" Info Bool where getField = not . Map.null . #updates descFor :: Bool -> Info -> Maybe Text