drop table if exists TagsOrdered; create table TagsOrdered as select * from BufferTags order by ID asc; drop table if exists TagsExtended; create table TagsExtended as select bt.ID as TagID, bt.CreatedWhen, (select toto.CreatedWhen from TagsOrdered toto where toto.ProjectID = bt.ProjectID and toto.ID > bt.ID limit 1) as NextTagCreatedWhen from BufferTags bt; drop table if exists WaitingReasons; create table WaitingReasons as select n.ID as NoteID, n.ObjectID as TaskID, IfNull(( select case when bt.NextTagCreatedWhen is not null THEN (st.Flags like '%IsCriticalChainTask%') or (st.Flags like '%IsCriticalPathTask%') ELSE (t.IsCritical = 'True') end from ScheduleTags st join TagsExtended bt on bt.TagID = st.TagID and st.TaskID = t.ID and n.CreatedWhen >= bt.CreatedWhen and (bt.NextTagCreatedWhen is null or n.CreatedWhen < bt.NextTagCreatedWhen) ), (t.IsCritical = 'True')) as OnCriticalChain from Notes n join Tasks t on n.ObjectID = t.ID and n.ObjectType = 'Task' where n.[Waiting reason] != ''

Waiting reasons

Created by:


{{TASKLUID}} select p.SpaceID, p.ID as ProjectID, t.Luid as TaskLuid, t.Description, n.Text as NoteText, n.Comment as NoteComment, n.CreatedWhen as NoteCreatedWhen, n.Kind as NoteKind, n.[Waiting reason] as WaitingReason, case when wr.OnCriticalChain = 1 then 'On CC' end as OnCriticalChain, 'blue_cell' as TASKLUID_CLASS from WaitingReasons wr join Tasks t on t.ID = wr.TaskID join Projects p on p.ID = t.ProjectID join Notes n on n.ID = wr.NoteID