[英]JIRA Log work with groovy script issue
Here is a code: 这是一个代码:
CM = ComponentManager.getInstance()
worklogManager = CM.getWorklogManager()
for(int i=0; i<=4; i++) {
worklog = new WorklogImpl(worklogManager, issue, null, issue.reporter.name, issue.summary, new Date(), null, null, 1*3600)
worklogManager.create(issue.reporter, worklog, 0L, false)
}
OR 要么
for(int i=0; i<=4; i++) {
params = WorklogInputParametersImpl
.issue( issue )
.startDate(new Date())
.timeSpent('1h')
.comment('123')
.buildNewEstimate()
result = wls.validateCreate(context, params)
wls.createAndAutoAdjustRemainingEstimate(context, result, true)
}
And here is a result: 结果如下:
5 worklog entries, with 1 hour spent but Logged: shows only 1 hour instead of 5 hours 5个工作日志条目,花费了1个小时但已记录:仅显示1个小时而不是5个小时
latest script runner addon with JIRA 6.1 same results with JIRA 5.1.7 JIRA 6.1的最新脚本执行器插件与JIRA 5.1.7的结果相同
Any ideas? 有任何想法吗?
Thanks! 谢谢!
Sergey 谢尔盖
I had a similar problem, solved it by changing the last parameter to true
in worklogManager.create()
. 我有一个类似的问题,通过将
worklogManager.create()
的最后一个参数更改为true
来worklogManager.create()
。 It dispatches the ISSUE_WORKLOGGED_ID event which I think is needed for the correct behaviour. 它调度ISSUE_WORKLOGGED_ID事件,我认为这是正确行为所必需的。
Solution is to calculate logged time manually: 解决方案是手动计算记录时间:
for(int i=0; i=4; i++) {
worklog = new WorklogImpl(
worklogManager,
issue,
null,
issue.reporter.name,
issue.summary,
new Date(),
null,
null,
1*3600
)
worklogManager.create(issue.reporter, worklog, 0L, false)
issue.timeSpent = issue.timeSpent == null
? 1*3600
: issue.timeSpent + 1*3600
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.