use year of latest update on gallery page

This commit is contained in:
Rhiannon Morris 2020-09-21 21:44:54 +02:00
parent 0a7fad8afe
commit c04f34083f
2 changed files with 5 additions and 1 deletions

View File

@ -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)

View File

@ -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