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 done Bool
closed UTCTime closed UTCTime
closer PersonId closer PersonId
discuss DiscussionId
UniqueTicket project number UniqueTicket project number

View file

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

View file

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