mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-19 23:51:54 +01:00
Avoid duplicate packages on tag page (fixes #116)
This commit is contained in:
parent
c0b3ea9302
commit
bb01d34d8c
@ -22,9 +22,12 @@ getTagR :: Slug -> Handler Html
|
|||||||
getTagR tagSlug = do
|
getTagR tagSlug = do
|
||||||
-- FIXME arguably: check if this tag is banned. Leaving it as displayed for
|
-- FIXME arguably: check if this tag is banned. Leaving it as displayed for
|
||||||
-- now, since someone needs to go out of their way to find it.
|
-- now, since someone needs to go out of their way to find it.
|
||||||
tags <- runDB $ selectList [TagTag ==. tagSlug] [Asc TagPackage]
|
packages' <- runDB $ E.select $ E.from $ \tag -> do
|
||||||
packages <- fmap catMaybes $ forM tags $ \(Entity _ t) -> do
|
E.groupBy (tag E.^. TagPackage)
|
||||||
let pname = tagPackage t
|
E.where_ $ tag E.^. TagTag E.==. E.val tagSlug
|
||||||
|
E.orderBy [E.asc $ tag E.^. TagPackage]
|
||||||
|
return $ tag E.^. TagPackage
|
||||||
|
packages <- fmap catMaybes $ forM packages' $ \(E.Value pname) -> do
|
||||||
mp <- getPackage $ toPathPiece pname
|
mp <- getPackage $ toPathPiece pname
|
||||||
return $ case mp of
|
return $ case mp of
|
||||||
Nothing -> Nothing
|
Nothing -> Nothing
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user