From 031a4c09306354ca462fe67550bb419b0c9e5270 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Sat, 11 Jan 2020 17:28:53 +0000 Subject: [PATCH] Display ticket class params AKA labels in ticket list view --- src/Vervis/Ticket.hs | 10 ++++++++-- src/Vervis/Widget/Ticket.hs | 3 ++- templates/ticket/widget/summary.hamlet | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Vervis/Ticket.hs b/src/Vervis/Ticket.hs index 50422c4..caab449 100644 --- a/src/Vervis/Ticket.hs +++ b/src/Vervis/Ticket.hs @@ -34,6 +34,7 @@ import Control.Arrow ((***)) import Data.Foldable (for_) import Data.Text (Text) import Database.Esqueleto +import Database.Esqueleto.PostgreSQL import Vervis.Foundation (AppDB) import Vervis.Model @@ -53,7 +54,10 @@ getTicketSummaries mfilt morder jid = fmap (map toSummary) $ select $ from $ `LeftOuterJoin` (tar `InnerJoin` ra `InnerJoin` ro `InnerJoin` i) `InnerJoin` d `LeftOuterJoin` m + `LeftOuterJoin` (tpc `InnerJoin` wf) ) -> do + on $ tpc ?. TicketParamClassField ==. wf ?. WorkflowFieldId + on $ just (t ^. TicketId) ==. tpc ?. TicketParamClassTicket on $ just (d ^. DiscussionId) ==. m ?. MessageRoot on $ t ^. TicketDiscuss ==. d ^. DiscussionId on $ ro ?. RemoteObjectInstance ==. i ?. InstanceId @@ -63,7 +67,7 @@ getTicketSummaries mfilt morder jid = fmap (map toSummary) $ select $ from $ on $ p ?. PersonIdent ==. s ?. SharerId on $ tal ?. TicketAuthorLocalAuthor ==. p ?. PersonId on $ just (t ^. TicketId) ==. tal ?. TicketAuthorLocalTicket - where_ $ t ^. TicketProject ==. val jid + where_ $ t ^. TicketProject ==. val jid groupBy ( t ^. TicketId, s ?. SharerId , ra ?. RemoteActorId, ro ?. RemoteObjectId, i ?. InstanceId @@ -80,9 +84,10 @@ getTicketSummaries mfilt morder jid = fmap (map toSummary) $ select $ from $ , t ^. TicketTitle , t ^. TicketStatus , count $ m ?. MessageId + , arrayRemoveNull $ maybeArray $ arrayAgg $ wf ?. WorkflowFieldName ) where - toSummary (Value n, ms, mi, mro, mra, Value c, Value t, Value d, Value r) = + toSummary (Value n, ms, mi, mro, mra, Value c, Value t, Value d, Value r, Value wfs) = TicketSummary { tsNumber = n , tsCreatedBy = @@ -94,6 +99,7 @@ getTicketSummaries mfilt morder jid = fmap (map toSummary) $ select $ from $ _ -> error "Ticket author DB invalid state" , tsCreatedAt = c , tsTitle = t + , tsLabels = wfs , tsStatus = d , tsComments = r } diff --git a/src/Vervis/Widget/Ticket.hs b/src/Vervis/Widget/Ticket.hs index 365bc90..4a2f566 100644 --- a/src/Vervis/Widget/Ticket.hs +++ b/src/Vervis/Widget/Ticket.hs @@ -1,6 +1,6 @@ {- This file is part of Vervis. - - - Written in 2016, 2019 by fr33domlover . + - Written in 2016, 2019, 2020 by fr33domlover . - - ♡ Copying is an act of love. Please copy, reuse and share. - @@ -50,6 +50,7 @@ data TicketSummary = TicketSummary , tsCreatedBy :: Either Sharer (Instance, RemoteObject, RemoteActor) , tsCreatedAt :: UTCTime , tsTitle :: Text + , tsLabels :: [Text] , tsStatus :: TicketStatus , tsComments :: Int } diff --git a/templates/ticket/widget/summary.hamlet b/templates/ticket/widget/summary.hamlet index d02fadd..9944ed2 100644 --- a/templates/ticket/widget/summary.hamlet +++ b/templates/ticket/widget/summary.hamlet @@ -1,6 +1,6 @@ $# This file is part of Vervis. $# -$# Written in 2016, 2019 by fr33domlover . +$# Written in 2016, 2019, 2020 by fr33domlover . $# $# ♡ Copying is an act of love. Please copy, reuse and share. $# @@ -37,6 +37,8 @@ $# . #{tsTitle ts} + $forall wfname <- tsLabels ts + \ [#{wfname}] $if tsComments ts > 0