Each ticket has a unique discussion ID

This commit is contained in:
fr33domlover 2016-05-18 09:44:32 +00:00
parent 604e3ca80a
commit c435dfa89b
3 changed files with 5 additions and 1 deletions

View file

@ -75,6 +75,7 @@ Ticket
done Bool
closed UTCTime
closer PersonId
discuss DiscussionId
UniqueTicket project number

View file

@ -71,6 +71,7 @@ editTicketAForm ticket pid = fmap fixDone $ Ticket
<*> areq checkBoxField "Done*" (Just $ ticketDone ticket)
<*> now
<*> pure (ticketCloser ticket)
<*> pure (ticketDiscuss ticket)
where
fixDone result = case (ticketDone ticket, ticketDone result) of
(True, True) -> result { ticketClosed = ticketClosed ticket }

View file

@ -83,6 +83,8 @@ postTicketsR shar proj = do
Entity pid project <- do
Entity sid _sharer <- getBy404 $ UniqueSharerIdent shar
getBy404 $ UniqueProject proj sid
update pid [ProjectNextTicket +=. 1]
did <- insert Discussion
let ticket = Ticket
{ ticketProject = pid
, ticketNumber = projectNextTicket project
@ -93,8 +95,8 @@ postTicketsR shar proj = do
, ticketDone = False
, ticketClosed = UTCTime (ModifiedJulianDay 0) 0
, ticketCloser = author
, ticketDiscuss = did
}
update pid [ProjectNextTicket +=. 1]
insert_ ticket
return $ ticketNumber ticket
setMessage "Ticket created."