From c435dfa89b67e5227b5945ca825a991b8706325e Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Wed, 18 May 2016 09:44:32 +0000 Subject: [PATCH] Each ticket has a unique discussion ID --- config/models | 1 + src/Vervis/Form/Ticket.hs | 1 + src/Vervis/Handler/Ticket.hs | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config/models b/config/models index 72bdb1e..8bb331e 100644 --- a/config/models +++ b/config/models @@ -75,6 +75,7 @@ Ticket done Bool closed UTCTime closer PersonId + discuss DiscussionId UniqueTicket project number diff --git a/src/Vervis/Form/Ticket.hs b/src/Vervis/Form/Ticket.hs index 4335a39..a5fb4db 100644 --- a/src/Vervis/Form/Ticket.hs +++ b/src/Vervis/Form/Ticket.hs @@ -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 } diff --git a/src/Vervis/Handler/Ticket.hs b/src/Vervis/Handler/Ticket.hs index 0039bef..901c295 100644 --- a/src/Vervis/Handler/Ticket.hs +++ b/src/Vervis/Handler/Ticket.hs @@ -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."