From f561fb0ce4b19128ebd97bce5819f00a1c830ae8 Mon Sep 17 00:00:00 2001 From: Dmitry Zuikov Date: Tue, 14 May 2024 07:07:43 +0300 Subject: [PATCH] wip --- .fixme-new/config | 2 +- fixme-new/lib/Fixme/State.hs | 40 +++++++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/.fixme-new/config b/.fixme-new/config index 8482d8d4..cd6efdfe 100644 --- a/.fixme-new/config +++ b/.fixme-new/config @@ -9,7 +9,7 @@ fixme-prefix TODO: fixme-prefix PR: fixme-prefix REVIEW: -fixme-git-scan-filter-days 100 +fixme-git-scan-filter-days 365 fixme-attribs assigned workflow diff --git a/fixme-new/lib/Fixme/State.hs b/fixme-new/lib/Fixme/State.hs index ff99cf3f..7c7162ff 100644 --- a/fixme-new/lib/Fixme/State.hs +++ b/fixme-new/lib/Fixme/State.hs @@ -142,22 +142,48 @@ createTables = do ddl [qc| drop view if exists fixmeattrview |] + let commits = [qc|name in ('commit','committer','committer-name','committer-email','commit-time')|] :: Text + ddl [qc| create view fixmeattrview as - with ranked as ( + with ranked1 as ( select fixme, name, value, row_number() over (partition by fixme, name order by ts desc nulls first) as rn from fixmeattr + where not ({commits}) + ), + ranked2 as ( + select + fixme, + name, + value, + row_number() over (partition by fixme, name order by ts asc nulls last) as rn + from fixmeattr + where ({commits}) + ) + + select distinct fixme,name,value + from + ( + select + fixme, + name, + value + from ranked1 + where rn = 1 + + union + + select + fixme, + name, + value + from ranked2 + where rn = 1 ) - select - fixme, - name, - value - from ranked - where rn = 1; |] ddl [qc|drop view if exists fixmeactualview|]