Include package count on snapshot page

This commit is contained in:
Michael Snoyman 2015-10-19 11:33:26 +00:00
parent 492eaf0444
commit 7cb7870d75
3 changed files with 8 additions and 1 deletions

View File

@ -21,6 +21,7 @@ getStackageHomeR name = do
let queryText = "" :: Text
exact = False
in $(widgetFile "hoogle-form")
packageCount <- getPackageCount sid
defaultLayout $ do
setTitle $ toHtml $ snapshotTitle snapshot
packages <- getPackages sid

View File

@ -37,6 +37,7 @@ module Stackage.Database
, currentSchema
, last5Lts5Nightly
, snapshotsJSON
, getPackageCount
) where
import Database.Sqlite (SqliteException)
@ -735,3 +736,8 @@ snapshotsJSON = do
"lts-" ++ show major ++ "." ++ show minor
printNightly day = "nightly-" ++ tshow day
getPackageCount :: GetStackageDatabase m
=> SnapshotId
-> m Int
getPackageCount sid = run $ count [SnapshotPackageSnapshot ==. sid]

View File

@ -38,7 +38,7 @@ $newline never
<a href=@{SnapshotR name HoogleDatabaseR}>
Download this hoogle database
<h3>Packages
<h3>Packages (#{packageCount})
<p>
<a href=@{SnapshotR name DocsR}>View documentation by modules