Docs fallback

This commit is contained in:
Michael Snoyman 2014-12-24 09:23:38 +02:00
parent a7254a0140
commit 5cb2a6a296

View file

@ -42,12 +42,18 @@ getStackageSdistR slug (PNVNameVersion name version) = packagePage
name (Just version)
(do
Entity sid _ <- getBy404 $ UniqueSnapshot slug
selectFirst
[ DocsName ==. name
, DocsVersion ==. version
, DocsSnapshot ==. Just sid
let loop [] = return Nothing
loop (x:xs) = do
mdocs <- selectFirst x []
case mdocs of
Nothing -> loop xs
Just _ -> return mdocs
loop
[ [DocsName ==. name, DocsVersion ==. version, DocsSnapshot ==. Just sid]
, [DocsName ==. name, DocsVersion ==. version]
, [DocsName ==. name]
]
[]) >>= sendResponse
) >>= sendResponse
addDownload :: Maybe PackageSetIdent
-> Maybe HackageView