mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-25 18:31:55 +01:00
Include latest LTS by GHC version (fixes #210)
This commit is contained in:
parent
ef8171bb94
commit
58c4e6c163
@ -31,6 +31,7 @@ getHomeR = track "Handler.Snapshots.getAllSnapshotsR" $ do
|
|||||||
getSnapshots Nothing snapshotsPerPage
|
getSnapshots Nothing snapshotsPerPage
|
||||||
((fromIntegral currentPage - 1) * snapshotsPerPage)
|
((fromIntegral currentPage - 1) * snapshotsPerPage)
|
||||||
let groups = groupUp now' snapshots
|
let groups = groupUp now' snapshots
|
||||||
|
latestLtsByGhc <- getLatestLtsByGhc
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
setTitle "Stackage Server"
|
setTitle "Stackage Server"
|
||||||
$(widgetFile "home")
|
$(widgetFile "home")
|
||||||
|
|||||||
@ -39,6 +39,7 @@ module Stackage.Database
|
|||||||
, last5Lts5Nightly
|
, last5Lts5Nightly
|
||||||
, snapshotsJSON
|
, snapshotsJSON
|
||||||
, getPackageCount
|
, getPackageCount
|
||||||
|
, getLatestLtsByGhc
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Database.Sqlite (SqliteException)
|
import Database.Sqlite (SqliteException)
|
||||||
@ -783,3 +784,15 @@ getPackageCount :: GetStackageDatabase m
|
|||||||
=> SnapshotId
|
=> SnapshotId
|
||||||
-> m Int
|
-> m Int
|
||||||
getPackageCount sid = run $ count [SnapshotPackageSnapshot ==. sid]
|
getPackageCount sid = run $ count [SnapshotPackageSnapshot ==. sid]
|
||||||
|
|
||||||
|
getLatestLtsByGhc :: GetStackageDatabase m
|
||||||
|
=> m [(Int, Int, Text)]
|
||||||
|
getLatestLtsByGhc = run $ fmap (map toTuple) $ do
|
||||||
|
E.select $ E.from $ \(lts `E.InnerJoin` snapshot) -> do
|
||||||
|
E.on $ lts E.^. LtsSnap E.==. snapshot E.^. SnapshotId
|
||||||
|
E.orderBy [E.desc (lts E.^. LtsMajor), E.desc (lts E.^. LtsMinor)]
|
||||||
|
E.groupBy (snapshot E.^. SnapshotGhc)
|
||||||
|
return (lts, snapshot)
|
||||||
|
where
|
||||||
|
toTuple (Entity _ lts, Entity _ snapshot) =
|
||||||
|
(ltsMajor lts, ltsMinor lts, snapshotGhc snapshot)
|
||||||
|
|||||||
@ -46,6 +46,13 @@
|
|||||||
on
|
on
|
||||||
<a href="https://haskell-lang.org/">
|
<a href="https://haskell-lang.org/">
|
||||||
haskell-lang.org
|
haskell-lang.org
|
||||||
|
|
||||||
|
<h3>
|
||||||
|
Latest LTS per GHC version
|
||||||
|
<ul>
|
||||||
|
$forall (major, minor, ghc) <- latestLtsByGhc
|
||||||
|
<li>
|
||||||
|
<a href=@{SnapshotR (SNLts major minor) StackageHomeR}>LTS #{major}.#{minor} for GHC #{ghc}
|
||||||
<div .span6>
|
<div .span6>
|
||||||
<h3>Snapshots
|
<h3>Snapshots
|
||||||
$forall stackages <- groups
|
$forall stackages <- groups
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user