mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-12 04:08:29 +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
|
||||
((fromIntegral currentPage - 1) * snapshotsPerPage)
|
||||
let groups = groupUp now' snapshots
|
||||
latestLtsByGhc <- getLatestLtsByGhc
|
||||
defaultLayout $ do
|
||||
setTitle "Stackage Server"
|
||||
$(widgetFile "home")
|
||||
|
||||
@ -39,6 +39,7 @@ module Stackage.Database
|
||||
, last5Lts5Nightly
|
||||
, snapshotsJSON
|
||||
, getPackageCount
|
||||
, getLatestLtsByGhc
|
||||
) where
|
||||
|
||||
import Database.Sqlite (SqliteException)
|
||||
@ -783,3 +784,15 @@ getPackageCount :: GetStackageDatabase m
|
||||
=> SnapshotId
|
||||
-> m Int
|
||||
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
|
||||
<a href="https://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>
|
||||
<h3>Snapshots
|
||||
$forall stackages <- groups
|
||||
|
||||
Loading…
Reference in New Issue
Block a user