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

View file

@ -1,6 +1,6 @@
$# This file is part of Vervis. $# 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. $# ♡ 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/>. $# <http://creativecommons.org/publicdomain/zero/1.0/>.
<p> <p>
<a href=@{TicketNewR shar proj}>Create new… <a href=@{TicketNewR shr prj}>Create new…
<p> <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} ^{filtWidget}
<input type="submit" value="Filter"> <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 $forall (Value number, Entity _ author, Value title, Value status) <- rows
<tr> <tr>
<td> <td>
<a href=@{TicketR shar proj number}>#{number} <a href=@{TicketR shr prj number}>#{number}
<td> <td>
^{personLinkW author} ^{personLinkW author}
<td> <td>
<a href=@{TicketR shar proj number}>#{title} <a href=@{TicketR shr prj number}>#{title}
<td> <td>
#{show status} #{show status}