mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-27 17:34:52 +09:00
Ticket assignee field
This commit is contained in:
parent
4e0e8cb736
commit
e398c86854
4 changed files with 45 additions and 29 deletions
|
@ -117,16 +117,17 @@ Repo
|
|||
UniqueRepo ident sharer
|
||||
|
||||
Ticket
|
||||
project ProjectId
|
||||
number Int
|
||||
created UTCTime
|
||||
creator PersonId
|
||||
title Text
|
||||
desc Text -- Assume this is Pandoc Markdown
|
||||
done Bool
|
||||
closed UTCTime
|
||||
closer PersonId
|
||||
discuss DiscussionId
|
||||
project ProjectId
|
||||
number Int
|
||||
created UTCTime
|
||||
creator PersonId
|
||||
title Text
|
||||
desc Text -- Assume this is Pandoc Markdown
|
||||
assignee PersonId Maybe
|
||||
done Bool
|
||||
closed UTCTime
|
||||
closer PersonId
|
||||
discuss DiscussionId
|
||||
|
||||
UniqueTicket project number
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ editTicketAForm ticket pid = fmap fixDone $ Ticket
|
|||
"Description (Markdown)"
|
||||
(Just $ Just $ Textarea $ ticketDesc ticket)
|
||||
)
|
||||
<*> pure (ticketAssignee ticket)
|
||||
<*> areq checkBoxField "Done*" (Just $ ticketDone ticket)
|
||||
<*> now
|
||||
<*> pure (ticketCloser ticket)
|
||||
|
|
|
@ -40,6 +40,7 @@ import Data.Text (Text)
|
|||
import Data.Time.Calendar (Day (..))
|
||||
import Data.Time.Clock (UTCTime (..), getCurrentTime)
|
||||
import Data.Time.Format (formatTime, defaultTimeLocale)
|
||||
import Data.Traversable (for)
|
||||
import Database.Esqueleto hiding ((==.), (+=.), update)
|
||||
import Database.Persist
|
||||
import Text.Blaze.Html (Html, toHtml)
|
||||
|
@ -106,16 +107,17 @@ postTicketsR shar proj = do
|
|||
}
|
||||
did <- insert discussion
|
||||
let ticket = Ticket
|
||||
{ ticketProject = pid
|
||||
, ticketNumber = projectNextTicket project
|
||||
, ticketCreated = now
|
||||
, ticketCreator = author
|
||||
, ticketTitle = ntTitle nt
|
||||
, ticketDesc = ntDesc nt
|
||||
, ticketDone = False
|
||||
, ticketClosed = UTCTime (ModifiedJulianDay 0) 0
|
||||
, ticketCloser = author
|
||||
, ticketDiscuss = did
|
||||
{ ticketProject = pid
|
||||
, ticketNumber = projectNextTicket project
|
||||
, ticketCreated = now
|
||||
, ticketCreator = author
|
||||
, ticketTitle = ntTitle nt
|
||||
, ticketDesc = ntDesc nt
|
||||
, ticketAssignee = Nothing
|
||||
, ticketDone = False
|
||||
, ticketClosed = UTCTime (ModifiedJulianDay 0) 0
|
||||
, ticketCloser = author
|
||||
, ticketDiscuss = did
|
||||
}
|
||||
insert_ ticket
|
||||
return $ ticketNumber ticket
|
||||
|
@ -135,19 +137,25 @@ getTicketNewR shar proj = do
|
|||
|
||||
getTicketR :: ShrIdent -> PrjIdent -> Int -> Handler Html
|
||||
getTicketR shar proj num = do
|
||||
(author, closer, ticket) <- runDB $ do
|
||||
Entity sid _sharer <- getBy404 $ UniqueSharer shar
|
||||
Entity pid _project <- getBy404 $ UniqueProject proj sid
|
||||
Entity _tid ticket <- getBy404 $ UniqueTicket pid num
|
||||
person <- get404 $ ticketCreator ticket
|
||||
author <- get404 $ personIdent person
|
||||
(author, massignee, closer, ticket) <- runDB $ do
|
||||
ticket <- do
|
||||
Entity s _ <- getBy404 $ UniqueSharer shar
|
||||
Entity p _ <- getBy404 $ UniqueProject proj s
|
||||
Entity _ t <- getBy404 $ UniqueTicket p num
|
||||
return t
|
||||
author <- do
|
||||
person <- get404 $ ticketCreator ticket
|
||||
get404 $ personIdent person
|
||||
massignee <- for (ticketAssignee ticket) $ \ pid -> do
|
||||
person <- get404 pid
|
||||
get404 $ personIdent person
|
||||
closer <-
|
||||
if ticketDone ticket
|
||||
then do
|
||||
person' <- get404 $ ticketCloser ticket
|
||||
get404 $ personIdent person'
|
||||
person <- get404 $ ticketCloser ticket
|
||||
get404 $ personIdent person
|
||||
else return author
|
||||
return (author, closer, ticket)
|
||||
return (author, massignee, closer, ticket)
|
||||
let desc = renderSourceT Markdown $ T.filter (/= '\r') $ ticketDesc ticket
|
||||
discuss =
|
||||
discussionW
|
||||
|
|
|
@ -23,6 +23,12 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
|
|||
Created on #{formatTime defaultTimeLocale "%F" $ ticketCreated ticket} by
|
||||
^{personLinkW author}
|
||||
|
||||
<p>
|
||||
$maybe assignee <- massignee
|
||||
Assigned to ^{personLinkW assignee}
|
||||
$nothing
|
||||
Not assigned
|
||||
|
||||
<p>
|
||||
Status:
|
||||
$if ticketDone ticket
|
||||
|
|
Loading…
Reference in a new issue