From 0b2090f0488d8c55b10e5ac099da5eeabe7820a6 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Sat, 26 May 2018 08:02:07 +0000 Subject: [PATCH] Fix issue: Ticket table was displaying project sharer instead of ticket author --- src/Vervis/Handler/Ticket.hs | 32 +++++++++++++++++--------------- templates/ticket/list.hamlet | 12 ++++++------ 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/Vervis/Handler/Ticket.hs b/src/Vervis/Handler/Ticket.hs index ee6665b..6085284 100644 --- a/src/Vervis/Handler/Ticket.hs +++ b/src/Vervis/Handler/Ticket.hs @@ -1,6 +1,6 @@ {- This file is part of Vervis. - - - Written in 2016 by fr33domlover . + - Written in 2016, 2018 by fr33domlover . - - ♡ 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 diff --git a/templates/ticket/list.hamlet b/templates/ticket/list.hamlet index c5681ad..f2f191b 100644 --- a/templates/ticket/list.hamlet +++ b/templates/ticket/list.hamlet @@ -1,6 +1,6 @@ $# This file is part of Vervis. $# -$# Written in 2016 by fr33domlover . +$# Written in 2016, 2018 by fr33domlover . $# $# ♡ Copying is an act of love. Please copy, reuse and share. $# @@ -13,12 +13,12 @@ $# with this software. If not, see $# .

- Create new… + Create new…

- View as tree… + View as tree… -

+ ^{filtWidget} @@ -31,10 +31,10 @@ $# . $forall (Value number, Entity _ author, Value title, Value status) <- rows - #{number} + #{number} ^{personLinkW author} - #{title} + #{title} #{show status}