mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-08 00:37:42 +00:00
UBERF-4374 Do not update time report for removed issues (#4059)
Signed-off-by: Alexander Onnikov <alexander.onnikov@xored.com>
This commit is contained in:
parent
e489cc5d1a
commit
75056b6e79
@ -309,25 +309,28 @@ async function doTimeReportUpdate (cud: TxCUD<TimeSpendReport>, tx: Tx, control:
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
case core.class.TxRemoveDoc: {
|
case core.class.TxRemoveDoc: {
|
||||||
const logTxes = Array.from(
|
if (!control.removedMap.has(parentTx.objectId)) {
|
||||||
await control.findAll(core.class.TxCollectionCUD, {
|
const logTxes = Array.from(
|
||||||
'tx.objectId': cud.objectId,
|
await control.findAll(core.class.TxCollectionCUD, {
|
||||||
_id: { $nin: [parentTx._id] }
|
'tx.objectId': cud.objectId,
|
||||||
})
|
_id: { $nin: [parentTx._id] }
|
||||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
||||||
).map(TxProcessor.extractTx)
|
|
||||||
const doc: TimeSpendReport | undefined = TxProcessor.buildDoc2Doc(logTxes)
|
|
||||||
if (doc !== undefined) {
|
|
||||||
const res = [
|
|
||||||
control.txFactory.createTxUpdateDoc<Issue>(parentTx.objectClass, parentTx.objectSpace, parentTx.objectId, {
|
|
||||||
$inc: { reportedTime: -1 * doc.value }
|
|
||||||
})
|
})
|
||||||
]
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||||
const [currentIssue] = await control.findAll(tracker.class.Issue, { _id: parentTx.objectId }, { limit: 1 })
|
).map(TxProcessor.extractTx)
|
||||||
currentIssue.reportedTime -= doc.value
|
const doc: TimeSpendReport | undefined = TxProcessor.buildDoc2Doc(logTxes)
|
||||||
currentIssue.remainingTime = Math.max(0, currentIssue.estimation - currentIssue.reportedTime)
|
if (doc !== undefined) {
|
||||||
updateIssueParentEstimations(currentIssue, res, control, currentIssue.parents, currentIssue.parents)
|
const res = [
|
||||||
return res
|
control.txFactory.createTxUpdateDoc<Issue>(parentTx.objectClass, parentTx.objectSpace, parentTx.objectId, {
|
||||||
|
$inc: { reportedTime: -1 * doc.value }
|
||||||
|
})
|
||||||
|
]
|
||||||
|
|
||||||
|
const [currentIssue] = await control.findAll(tracker.class.Issue, { _id: parentTx.objectId }, { limit: 1 })
|
||||||
|
currentIssue.reportedTime -= doc.value
|
||||||
|
currentIssue.remainingTime = Math.max(0, currentIssue.estimation - currentIssue.reportedTime)
|
||||||
|
updateIssueParentEstimations(currentIssue, res, control, currentIssue.parents, currentIssue.parents)
|
||||||
|
return res
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user