This commit is contained in:
Dmitry Zuikov 2024-09-10 06:37:29 +03:00
parent 48bf25f8a6
commit fd4d9f1f55
2 changed files with 10 additions and 5 deletions

View File

@ -378,10 +378,10 @@ runTop forms = do
withState $ transactional do withState $ transactional do
for_ fxs $ \fme -> do for_ fxs $ \fme -> do
let fn = HM.lookup "file" (fixmeAttr fme) <&> Text.unpack . coerce let fn = HM.lookup "file" (fixmeAttr fme) <&> Text.unpack . coerce
fmeRich <- lift $ maybe1 fn (pure mempty) (flip getMetaDataFromGitBlame fme) fmeRich <- lift $ maybe1 fn (pure mempty) (`getMetaDataFromGitBlame` fme)
notice $ "fixme" <+> pretty (fixmeKey fme) notice $ "fixme" <+> pretty (fixmeKey fme)
insertFixme (fmeRich <> fme) insertFixme (fmeRich <> fme)
-- TODO: remove-code-duplucation -- TODO: remove-code-duplication
for_ fn insertScanned for_ fn insertScanned
entry $ bindMatch "fixme:scan:list" $ nil_ $ const do entry $ bindMatch "fixme:scan:list" $ nil_ $ const do

View File

@ -277,13 +277,17 @@ listFixme expr = do
let sql = [qc| let sql = [qc|
with s1 as ( with s1 as (
select (cast (json_group_object(o.k, o.v) as blob)) as blob from object o select cast (json_insert(json_group_object(o.k, o.v), '$.w', max(o.w)) as blob) as blob
from object o
group by o.o group by o.o
) )
select blob from s1 select s1.blob from s1
where where
{w} {w}
{end} {end}
order by
json_extract(s1.blob, '$.commit-time') asc nulls last,
json_extract(s1.blob, '$.w') asc nulls last
|] |]
debug $ pretty sql debug $ pretty sql
@ -296,7 +300,8 @@ getFixme :: (FixmePerks m, MonadReader FixmeEnv m) => FixmeKey -> m (Maybe Fixme
getFixme key = do getFixme key = do
let sql = [qc| let sql = [qc|
select (cast (json_group_object(o.k, o.v) as blob)) as blob from object o select cast (json_insert(json_group_object(o.k, o.v), '$.w', max(o.w)) as blob) as blob
from object o
where o.o = ? where o.o = ?
group by o.o group by o.o
limit 1 limit 1