diff --git a/fixme-new/lib/Fixme/Run.hs b/fixme-new/lib/Fixme/Run.hs index d31210d3..8402f180 100644 --- a/fixme-new/lib/Fixme/Run.hs +++ b/fixme-new/lib/Fixme/Run.hs @@ -378,10 +378,10 @@ runTop forms = do withState $ transactional do for_ fxs $ \fme -> do 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) insertFixme (fmeRich <> fme) - -- TODO: remove-code-duplucation + -- TODO: remove-code-duplication for_ fn insertScanned entry $ bindMatch "fixme:scan:list" $ nil_ $ const do diff --git a/fixme-new/lib/Fixme/State.hs b/fixme-new/lib/Fixme/State.hs index 2c68e2d6..1bfafb4e 100644 --- a/fixme-new/lib/Fixme/State.hs +++ b/fixme-new/lib/Fixme/State.hs @@ -277,13 +277,17 @@ listFixme expr = do let sql = [qc| 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 ) - select blob from s1 + select s1.blob from s1 where {w} {end} + order by + json_extract(s1.blob, '$.commit-time') asc nulls last, + json_extract(s1.blob, '$.w') asc nulls last |] debug $ pretty sql @@ -296,7 +300,8 @@ getFixme :: (FixmePerks m, MonadReader FixmeEnv m) => FixmeKey -> m (Maybe Fixme getFixme key = do 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 = ? group by o.o limit 1