Display ticket class params AKA labels in ticket list view

This commit is contained in:
fr33domlover 2020-01-11 17:28:53 +00:00
parent 90e3b677c5
commit 031a4c0930
3 changed files with 13 additions and 4 deletions

View file

@ -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
}

View file

@ -1,6 +1,6 @@
{- This file is part of Vervis.
-
- Written in 2016, 2019 by fr33domlover <fr33domlover@riseup.net>.
- Written in 2016, 2019, 2020 by fr33domlover <fr33domlover@riseup.net>.
-
- 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
}

View file

@ -1,6 +1,6 @@
$# This file is part of Vervis.
$#
$# Written in 2016, 2019 by fr33domlover <fr33domlover@riseup.net>.
$# Written in 2016, 2019, 2020 by fr33domlover <fr33domlover@riseup.net>.
$#
$# ♡ Copying is an act of love. Please copy, reuse and share.
$#
@ -37,6 +37,8 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
<span .ticket-title-column>
<a href=@{TicketR shr prj $ tsNumber ts}>
#{tsTitle ts}
$forall wfname <- tsLabels ts
\ [#{wfname}]
<span .ticket-tree-column>
$if tsComments ts > 0