fix sfw sort with nsfw update

if the last update to an item is nsfw-only, then it would affect the
sfw sorting, even tho it is not relevant, and even if it had ignore-sort
set. now it works properly in that situation
This commit is contained in:
rhiannon morris 2024-01-09 15:35:31 +01:00
parent 09897f27d9
commit bde75df8ca

View file

@ -163,7 +163,8 @@ instance HasField "notMine" Info Bool where getField = isJust . #artist
instance HasField "latestDate" Info (Bool -> Date) where
getField info@(Info {date=date}) nsfw =
maximum $ date : mapMaybe relDate (updatesFor nsfw info)
where relDate (date, us) = date <$ guard (not $ any #ignoreSort us)
where
relDate (date, us) = date <$ guard (not $ null us || any #ignoreSort us)
instance HasField "latestYear" Info (Bool -> Int) where
getField info nsfw = #year $ #latestDate info nsfw