Fix issue: Ticket table was displaying project sharer instead of ticket author

This commit is contained in:
fr33domlover 2018-05-26 08:02:07 +00:00
parent 5c12e7c34f
commit 0b2090f048
2 changed files with 23 additions and 21 deletions

View file

@ -1,6 +1,6 @@
{- This file is part of Vervis.
-
- Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
- Written in 2016, 2018 by fr33domlover <fr33domlover@riseup.net>.
-
- Copying is an act of love. Please copy, reuse and share.
-
@ -101,7 +101,7 @@ import Vervis.Widget.Sharer (personLinkW)
import Vervis.Widget.Ticket
getTicketsR :: ShrIdent -> PrjIdent -> Handler Html
getTicketsR shar proj = do
getTicketsR shr prj = do
((filtResult, filtWidget), filtEnctype) <- runFormGet ticketFilterForm
let tf =
case filtResult of
@ -109,19 +109,21 @@ getTicketsR shar proj = do
FormMissing -> def
FormFailure l ->
error $ "Ticket filter form failed: " ++ show l
rows <- runDB $ select $ from $ \ (sharer, project, ticket) -> do
where_ $ filterTickets tf ticket $
sharer ^. SharerIdent ==. val shar &&.
project ^. ProjectSharer ==. sharer ^. SharerId &&.
project ^. ProjectIdent ==. val proj &&.
ticket ^. TicketProject ==. project ^. ProjectId
orderBy [asc $ ticket ^. TicketNumber]
return
( ticket ^. TicketNumber
, sharer
, ticket ^. TicketTitle
, ticket ^. TicketStatus
)
rows <- runDB $ do
Entity sid _ <- getBy404 $ UniqueSharer shr
Entity jid _ <- getBy404 $ UniqueProject prj sid
select $ from $ \ (ticket `InnerJoin` person `InnerJoin` sharer) -> do
on $ person ^. PersonIdent ==. sharer ^. SharerId
on $ ticket ^. TicketCreator ==. person ^. PersonId
where_ $ filterTickets tf ticket $
ticket ^. TicketProject ==. val jid
orderBy [asc $ ticket ^. TicketNumber]
return
( ticket ^. TicketNumber
, sharer
, ticket ^. TicketTitle
, ticket ^. TicketStatus
)
defaultLayout $(widgetFile "ticket/list")
postTicketsR :: ShrIdent -> PrjIdent -> Handler Html

View file

@ -1,6 +1,6 @@
$# This file is part of Vervis.
$#
$# Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
$# Written in 2016, 2018 by fr33domlover <fr33domlover@riseup.net>.
$#
$# ♡ Copying is an act of love. Please copy, reuse and share.
$#
@ -13,12 +13,12 @@ $# with this software. If not, see
$# <http://creativecommons.org/publicdomain/zero/1.0/>.
<p>
<a href=@{TicketNewR shar proj}>Create new…
<a href=@{TicketNewR shr prj}>Create new…
<p>
<a href=@{TicketTreeR shar proj}>View as tree…
<a href=@{TicketTreeR shr prj}>View as tree…
<form method=GET action=@{TicketsR shar proj} enctype=#{filtEnctype}>
<form method=GET action=@{TicketsR shr prj} enctype=#{filtEnctype}>
^{filtWidget}
<input type="submit" value="Filter">
@ -31,10 +31,10 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
$forall (Value number, Entity _ author, Value title, Value status) <- rows
<tr>
<td>
<a href=@{TicketR shar proj number}>#{number}
<a href=@{TicketR shr prj number}>#{number}
<td>
^{personLinkW author}
<td>
<a href=@{TicketR shar proj number}>#{title}
<a href=@{TicketR shr prj number}>#{title}
<td>
#{show status}