Stop assigning ticket numbers, allow them to be NULL

This commit is contained in:
fr33domlover 2020-02-03 15:44:16 +00:00
parent c5996bd226
commit 1a5654f8ae
7 changed files with 21 additions and 11 deletions

View file

@ -344,7 +344,7 @@ TicketParamClass
Ticket
project ProjectId
number Int
number Int Maybe
created UTCTime
title Text -- HTML
source Text -- Pandoc Markdown
@ -357,7 +357,7 @@ Ticket
followers FollowerSetId
accept OutboxItemId
UniqueTicket project number
-- UniqueTicket project number
UniqueTicketDiscussion discuss
UniqueTicketFollowers followers
UniqueTicketAccept accept

View file

@ -763,9 +763,11 @@ offerTicketC shrUser summary audience offer@(Offer ticket uTarget) = runExceptT
prj == prjProject &&
localRecipProject project -> do
insertToInbox ibid
{-
num <-
((subtract 1) . projectNextTicket) <$>
updateGet jid [ProjectNextTicket +=. 1]
-}
obiidAccept <- do
obidProject <- projectOutbox <$> getJust jid
now <- liftIO getCurrentTime
@ -776,9 +778,9 @@ offerTicketC shrUser summary audience offer@(Offer ticket uTarget) = runExceptT
persistJSONObjectFromDoc $ Doc hLocal emptyActivity
, outboxItemPublished = now
}
tid <- insertTicket jid {-tids-} num obiidAccept
tid <- insertTicket jid {-tids-} {-num-} obiidAccept
docAccept <- insertAccept pidAuthor sid jid fsid luOffer obiidAccept tid
publishAccept pidAuthor sid jid fsid luOffer num obiidAccept docAccept
publishAccept pidAuthor sid jid fsid luOffer {-num-} obiidAccept docAccept
(pidsTeam, remotesTeam) <-
if localRecipProjectTeam project
then getProjectTeam sid
@ -841,12 +843,12 @@ offerTicketC shrUser summary audience offer@(Offer ticket uTarget) = runExceptT
obiid
[OutboxItemActivity =. persistJSONObjectFromDoc doc]
return doc
insertTicket jid {-tidsDeps-} next obiidAccept = do
insertTicket jid {-tidsDeps-} {-next-} obiidAccept = do
did <- insert Discussion
fsid <- insert FollowerSet
tid <- insert Ticket
{ ticketProject = jid
, ticketNumber = next
, ticketNumber = Nothing
, ticketCreated = now
, ticketTitle = unTextHtml $ AP.ticketSummary ticket
, ticketSource =
@ -868,7 +870,7 @@ offerTicketC shrUser summary audience offer@(Offer ticket uTarget) = runExceptT
--insertMany_ $ map (TicketDependency tid) tidsDeps
-- insert_ $ Follow pidAuthor fsid False True
return tid
publishAccept pidAuthor sid jid fsid luOffer num obiid doc = do
publishAccept pidAuthor sid jid fsid luOffer {-num-} obiid doc = do
now <- liftIO getCurrentTime
let dont = Authority "dont-do.any-forwarding" Nothing
remotesHttp <- do

View file

@ -240,9 +240,11 @@ projectOfferTicketF
delete ibiid
return Nothing
Just _ibirid -> do
{-
next <-
((subtract 1) . projectNextTicket) <$>
updateGet jid [ProjectNextTicket +=. 1]
-}
did <- insert Discussion
fsid <- insert FollowerSet
@ -261,7 +263,7 @@ projectOfferTicketF
tid <- insert Ticket
{ ticketProject = jid
, ticketNumber = next
, ticketNumber = Nothing
, ticketCreated = now
, ticketTitle = unTextHtml $ AP.ticketSummary ticket
, ticketSource =

View file

@ -1,6 +1,6 @@
{- This file is part of Vervis.
-
- Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
- Written in 2016, 2020 by fr33domlover <fr33domlover@riseup.net>.
-
- Copying is an act of love. Please copy, reuse and share.
-

View file

@ -895,7 +895,7 @@ getTicketDeps forward shr prj tkhid = do
E.on $ E.just (t E.^. TicketId) E.==. tal E.?. TicketAuthorLocalTicket
E.on $ td E.^. to' E.==. t E.^. TicketId
E.where_ $ td E.^. from' E.==. E.val tid
E.orderBy [E.asc $ t E.^. TicketNumber]
E.orderBy [E.asc $ t E.^. TicketId]
return
( td E.^. TicketDependencyId
, t E.^. TicketId

View file

@ -1229,6 +1229,10 @@ changes hLocal ctx =
, addEntities model_2020_01_05
-- 185
, addFieldPrimOptional "WorkflowField" (Nothing :: Maybe Int) "color"
-- 186
, removeUnique "Ticket" "UniqueTicket"
-- 187
, setFieldMaybe "Ticket" "number"
]
migrateDB

View file

@ -1,6 +1,6 @@
{- This file is part of Vervis.
-
- Written in 2016, 2018, 2019 by fr33domlover <fr33domlover@riseup.net>.
- Written in 2016, 2018, 2019, 2020 by fr33domlover <fr33domlover@riseup.net>.
-
- Copying is an act of love. Please copy, reuse and share.
-
@ -90,7 +90,9 @@ instance PersistEntityGraphSelect Ticket TicketDependency where
selectorParam _ = ticketProject
selectorField _ = TicketProject
{-
instance PersistEntityGraphNumbered Ticket TicketDependency where
numberParam _ = ticketNumber
numberField _ = TicketNumber
uniqueNode _ = UniqueTicket
-}