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) | [(the year, infopath) |
infopath@(_, info) <- infos, infopath@(_, info) <- infos,
then sortOn by Down info, then sortOn by Down info,
let year = #year info, let year = #latestYear info,
then group by Down year using groupBy'] then group by Down year using groupBy']
groupBy' f = groupBy ((==) `on` f) 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 instance HasField "latestDate" Info Day where
getField (Info {date, updates}) = maximum (date : Map.keys updates) 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 instance HasField "updated" Info Bool where getField = not . Map.null . #updates
descFor :: Bool -> Info -> Maybe Text descFor :: Bool -> Info -> Maybe Text