This commit is contained in:
Dmitry Zuikov 2024-03-29 08:38:21 +03:00
parent b17c20d980
commit 9b9f412956
2 changed files with 9 additions and 5 deletions

View File

@ -10,6 +10,7 @@ import Lucid.Html5 hiding (for_)
import Data.Text (Text)
import Data.Text qualified as Text
import Data.Word
import Data.ByteString.Lazy
import Text.Pandoc
import Text.Pandoc.Error (handleError)
@ -27,14 +28,14 @@ renderMarkdown markdown = case markdownToHtml markdown of
Right html -> toHtmlRaw $ Text.pack html
renderEntries :: Monad m => HashMap Text Text -> [(HashVal, Text, Text)] -> m ByteString
renderEntries :: Monad m => HashMap Text Text -> [(HashVal, Text, Text, Word64)] -> m ByteString
renderEntries _ items = pure $ renderBS do
doctypehtml_ do
head_ mempty do
meta_ [charset_ "utf-8"]
body_ mempty do
for_ items $ \(h,n,b) -> do
for_ items $ \(h,n,b,t) -> do
div_ do
when ( Text.length n > 2) do

View File

@ -44,6 +44,7 @@ import Text.InterpolatedString.Perl6 (qc)
import System.Environment (getProgName, getArgs)
import System.Environment
import System.Posix.Signals
import Data.Word
import System.Exit
@ -217,18 +218,20 @@ instance (MonadUnliftIO m, HasOracleEnv m) => HandleMethod m RpcChannelQuery whe
listEntries args = do
env <- getOracleEnv
withOracleEnv env do
items <- withState $ select_ @_ @(HashVal, Text, Text) [qc|
items <- withState $ select_ @_ @(HashVal, Text, Text, Word64) [qc|
SELECT
lwwref,
name,
brief
brief,
repoheadseq
FROM (
SELECT
lwwref,
name,
brief,
ROW_NUMBER() OVER (PARTITION BY lwwref ORDER BY lwwseq DESC) as rn
repoheadseq,
ROW_NUMBER() OVER (PARTITION BY lwwref ORDER BY lwwseq DESC, repoheadseq DESC) as rn
FROM gitrepofact
) as s0
WHERE rn = 1;