Ticket dependencies in DB and per-ticket list of children

This commit is contained in:
fr33domlover 2016-06-07 20:16:15 +00:00
parent 11d4a955d8
commit 5557e65f66
6 changed files with 69 additions and 0 deletions

View file

@ -132,6 +132,12 @@ Ticket
UniqueTicket project number UniqueTicket project number
TicketDependency
parent TicketId
child TicketId
UniqueTicketDependency parent child
TicketClaimRequest TicketClaimRequest
person PersonId person PersonId
ticket TicketId ticket TicketId

View file

@ -108,5 +108,6 @@
/s/#ShrIdent/p/#PrjIdent/t/#Int/d/#Int TicketMessageR GET POST /s/#ShrIdent/p/#PrjIdent/t/#Int/d/#Int TicketMessageR GET POST
/s/#ShrIdent/p/#PrjIdent/t/#Int/d/!reply TicketTopReplyR GET /s/#ShrIdent/p/#PrjIdent/t/#Int/d/!reply TicketTopReplyR GET
/s/#ShrIdent/p/#PrjIdent/t/#Int/d/#Int/reply TicketReplyR GET /s/#ShrIdent/p/#PrjIdent/t/#Int/d/#Int/reply TicketReplyR GET
/s/#ShrIdent/p/#PrjIdent/t/#Int/deps TicketDepsR GET
/s/#ShrIdent/p/#PrjIdent/w/+Texts WikiPageR GET /s/#ShrIdent/p/#PrjIdent/w/+Texts WikiPageR GET

View file

@ -475,5 +475,8 @@ instance YesodBreadcrumbs App where
, Just $ , Just $
TicketMessageR shar proj num cnum TicketMessageR shar proj num cnum
) )
TicketDepsR shr prj num -> ( "Dependencies"
, Just $ TicketR shr prj num
)
WikiPageR shr prj _page -> ("Wiki", Just $ ProjectR shr prj) WikiPageR shr prj _page -> ("Wiki", Just $ ProjectR shr prj)

View file

@ -38,6 +38,7 @@ module Vervis.Handler.Ticket
, postTicketMessageR , postTicketMessageR
, getTicketTopReplyR , getTicketTopReplyR
, getTicketReplyR , getTicketReplyR
, getTicketDepsR
) )
where where
@ -497,3 +498,28 @@ getTicketReplyR shar proj tnum cnum =
(TicketMessageR shar proj tnum) (TicketMessageR shar proj tnum)
(selectDiscussionId shar proj tnum) (selectDiscussionId shar proj tnum)
cnum cnum
getTicketDepsR :: ShrIdent -> PrjIdent -> Int -> Handler Html
getTicketDepsR shr prj num = do
rows <- runDB $ do
Entity sid _ <- getBy404 $ UniqueSharer shr
Entity jid _ <- getBy404 $ UniqueProject prj sid
Entity tid _ <- getBy404 $ UniqueTicket jid num
select $ from $
\ ( td `InnerJoin`
ticket `InnerJoin`
person `InnerJoin`
sharer
) -> do
on $ person ^. PersonIdent E.==. sharer ^. SharerId
on $ ticket ^. TicketCreator E.==. person ^. PersonId
on $ td ^. TicketDependencyChild E.==. ticket ^. TicketId
where_ $ td ^. TicketDependencyParent E.==. val tid
orderBy [asc $ ticket ^. TicketNumber]
return
( ticket ^. TicketNumber
, sharer
, ticket ^. TicketTitle
, ticket ^. TicketDone
)
defaultLayout $(widgetFile "ticket/dep/list")

View file

@ -0,0 +1,30 @@
$# This file is part of Vervis.
$#
$# Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
$#
$# ♡ Copying is an act of love. Please copy, reuse and share.
$#
$# The author(s) have dedicated all copyright and related and neighboring
$# rights to this software to the public domain worldwide. This software is
$# distributed without any warranty.
$#
$# You should have received a copy of the CC0 Public Domain Dedication along
$# with this software. If not, see
$# <http://creativecommons.org/publicdomain/zero/1.0/>.
<table>
<tr>
<th>Number
<th>Author
<th>Title
<th>Done
$forall (Value number, Entity _ author, Value title, Value done) <- rows
<tr>
<td>
<a href=@{TicketR shr prj number}>#{number}
<td>
^{personLinkW author}
<td>
<a href=@{TicketR shr prj number}>#{title}
<td>
#{done}

View file

@ -50,6 +50,9 @@ $if not $ ticketDone ticket
<p> <p>
<a href=@{ClaimRequestsTicketR shar proj num}>Claim requests <a href=@{ClaimRequestsTicketR shar proj num}>Claim requests
<p>
<a href=@{TicketDepsR shar proj num}>Dependencies
<p> <p>
Status: # Status: #
$if ticketDone ticket $if ticketDone ticket