1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-29 00:44:52 +09:00

Ticket assignee field

This commit is contained in:
fr33domlover 2016-06-01 16:20:19 +00:00
parent 4e0e8cb736
commit e398c86854
4 changed files with 45 additions and 29 deletions

View file

@ -117,16 +117,17 @@ Repo
UniqueRepo ident sharer UniqueRepo ident sharer
Ticket Ticket
project ProjectId project ProjectId
number Int number Int
created UTCTime created UTCTime
creator PersonId creator PersonId
title Text title Text
desc Text -- Assume this is Pandoc Markdown desc Text -- Assume this is Pandoc Markdown
done Bool assignee PersonId Maybe
closed UTCTime done Bool
closer PersonId closed UTCTime
discuss DiscussionId closer PersonId
discuss DiscussionId
UniqueTicket project number UniqueTicket project number

View file

@ -70,6 +70,7 @@ editTicketAForm ticket pid = fmap fixDone $ Ticket
"Description (Markdown)" "Description (Markdown)"
(Just $ Just $ Textarea $ ticketDesc ticket) (Just $ Just $ Textarea $ ticketDesc ticket)
) )
<*> pure (ticketAssignee ticket)
<*> areq checkBoxField "Done*" (Just $ ticketDone ticket) <*> areq checkBoxField "Done*" (Just $ ticketDone ticket)
<*> now <*> now
<*> pure (ticketCloser ticket) <*> pure (ticketCloser ticket)

View file

@ -40,6 +40,7 @@ import Data.Text (Text)
import Data.Time.Calendar (Day (..)) import Data.Time.Calendar (Day (..))
import Data.Time.Clock (UTCTime (..), getCurrentTime) import Data.Time.Clock (UTCTime (..), getCurrentTime)
import Data.Time.Format (formatTime, defaultTimeLocale) import Data.Time.Format (formatTime, defaultTimeLocale)
import Data.Traversable (for)
import Database.Esqueleto hiding ((==.), (+=.), update) import Database.Esqueleto hiding ((==.), (+=.), update)
import Database.Persist import Database.Persist
import Text.Blaze.Html (Html, toHtml) import Text.Blaze.Html (Html, toHtml)
@ -106,16 +107,17 @@ postTicketsR shar proj = do
} }
did <- insert discussion did <- insert discussion
let ticket = Ticket let ticket = Ticket
{ ticketProject = pid { ticketProject = pid
, ticketNumber = projectNextTicket project , ticketNumber = projectNextTicket project
, ticketCreated = now , ticketCreated = now
, ticketCreator = author , ticketCreator = author
, ticketTitle = ntTitle nt , ticketTitle = ntTitle nt
, ticketDesc = ntDesc nt , ticketDesc = ntDesc nt
, ticketDone = False , ticketAssignee = Nothing
, ticketClosed = UTCTime (ModifiedJulianDay 0) 0 , ticketDone = False
, ticketCloser = author , ticketClosed = UTCTime (ModifiedJulianDay 0) 0
, ticketDiscuss = did , ticketCloser = author
, ticketDiscuss = did
} }
insert_ ticket insert_ ticket
return $ ticketNumber ticket return $ ticketNumber ticket
@ -135,19 +137,25 @@ getTicketNewR shar proj = do
getTicketR :: ShrIdent -> PrjIdent -> Int -> Handler Html getTicketR :: ShrIdent -> PrjIdent -> Int -> Handler Html
getTicketR shar proj num = do getTicketR shar proj num = do
(author, closer, ticket) <- runDB $ do (author, massignee, closer, ticket) <- runDB $ do
Entity sid _sharer <- getBy404 $ UniqueSharer shar ticket <- do
Entity pid _project <- getBy404 $ UniqueProject proj sid Entity s _ <- getBy404 $ UniqueSharer shar
Entity _tid ticket <- getBy404 $ UniqueTicket pid num Entity p _ <- getBy404 $ UniqueProject proj s
person <- get404 $ ticketCreator ticket Entity _ t <- getBy404 $ UniqueTicket p num
author <- get404 $ personIdent person return t
author <- do
person <- get404 $ ticketCreator ticket
get404 $ personIdent person
massignee <- for (ticketAssignee ticket) $ \ pid -> do
person <- get404 pid
get404 $ personIdent person
closer <- closer <-
if ticketDone ticket if ticketDone ticket
then do then do
person' <- get404 $ ticketCloser ticket person <- get404 $ ticketCloser ticket
get404 $ personIdent person' get404 $ personIdent person
else return author else return author
return (author, closer, ticket) return (author, massignee, closer, ticket)
let desc = renderSourceT Markdown $ T.filter (/= '\r') $ ticketDesc ticket let desc = renderSourceT Markdown $ T.filter (/= '\r') $ ticketDesc ticket
discuss = discuss =
discussionW discussionW

View file

@ -23,6 +23,12 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
Created on #{formatTime defaultTimeLocale "%F" $ ticketCreated ticket} by Created on #{formatTime defaultTimeLocale "%F" $ ticketCreated ticket} by
^{personLinkW author} ^{personLinkW author}
<p>
$maybe assignee <- massignee
Assigned to ^{personLinkW assignee}
$nothing
Not assigned
<p> <p>
Status: Status:
$if ticketDone ticket $if ticketDone ticket