Skip to content

Commit

Permalink
Try showing less snapshots #311
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Apr 21, 2022
1 parent be614d4 commit 4ef23fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Handler/Package.hs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ getPackageSnapshotsR :: PackageNameP -> Handler Html
getPackageSnapshotsR pn =
track "Handler.Package.getPackageSnapshotsR" $ do
cacheSeconds $ 60 * 60 * 24
snapshots <- getSnapshotsForPackage pn Nothing
snapshots <- getLtsSnapshotsForPackage pn (Just 100)
defaultLayout
(do setTitle ("Packages for " >> toHtml pn)
$(combineStylesheets 'StaticR [css_font_awesome_min_css])
Expand Down
8 changes: 5 additions & 3 deletions src/Stackage/Database/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -638,15 +638,17 @@ stringToArray ::
-> SqlExpr (Value [String])
stringToArray s1 s2 = unsafeSqlFunction "string_to_array" (s1, s2)

getSnapshotsForPackage
getLtsSnapshotsForPackage
:: GetStackageDatabase env m
=> PackageNameP
-> Maybe Int
-> m [(CompilerP, SnapshotPackageInfo)]
getSnapshotsForPackage pname mlimit =
getLtsSnapshotsForPackage pname mlimit =
fmap (first unValue) <$>
run (snapshotPackageInfoQuery $ \_sp s pn _v spiQ -> do
where_ (pn ^. PackageNameName ==. val pname)
where_ $
pn ^. PackageNameName ==. val pname &&.
(s ^. snapshotName `ilike` val "lts%")
orderBy [desc (s ^. SnapshotCreated)]
forM_ mlimit (limit . fromIntegral)
pure (s ^. SnapshotCompiler, spiQ))
Expand Down

0 comments on commit 4ef23fd

Please sign in to comment.