mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-02-07 16:47:27 +01:00
Insist on latest LTS on homepage #216
This commit is contained in:
parent
8fb3678d5b
commit
bcf86a1d40
@ -791,12 +791,17 @@ getPackageCount sid = run $ count [SnapshotPackageSnapshot ==. sid]
|
|||||||
|
|
||||||
getLatestLtsByGhc :: GetStackageDatabase m
|
getLatestLtsByGhc :: GetStackageDatabase m
|
||||||
=> m [(Int, Int, Text)]
|
=> m [(Int, Int, Text)]
|
||||||
getLatestLtsByGhc = run $ fmap (map toTuple) $ do
|
getLatestLtsByGhc = run $ fmap (dedupe . map toTuple) $ do
|
||||||
E.select $ E.from $ \(lts `E.InnerJoin` snapshot) -> do
|
E.select $ E.from $ \(lts `E.InnerJoin` snapshot) -> do
|
||||||
E.on $ lts E.^. LtsSnap E.==. snapshot E.^. SnapshotId
|
E.on $ lts E.^. LtsSnap E.==. snapshot E.^. SnapshotId
|
||||||
E.orderBy [E.desc (lts E.^. LtsMajor), E.desc (lts E.^. LtsMinor)]
|
E.orderBy [E.desc (lts E.^. LtsMajor), E.desc (lts E.^. LtsMinor)]
|
||||||
E.groupBy (snapshot E.^. SnapshotGhc)
|
E.groupBy (snapshot E.^. SnapshotGhc, lts E.^. LtsMajor, lts E.^. LtsMinor)
|
||||||
return (lts, snapshot)
|
return (lts, snapshot)
|
||||||
where
|
where
|
||||||
toTuple (Entity _ lts, Entity _ snapshot) =
|
toTuple (Entity _ lts, Entity _ snapshot) =
|
||||||
(ltsMajor lts, ltsMinor lts, snapshotGhc snapshot)
|
(ltsMajor lts, ltsMinor lts, snapshotGhc snapshot)
|
||||||
|
|
||||||
|
dedupe [] = []
|
||||||
|
dedupe (x:xs) = x : dedupe (dropWhile (\y -> thd x == thd y) xs)
|
||||||
|
|
||||||
|
thd (_, _, x) = x
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user