英文:
Get all work items where status changed in the last seven days
问题
我尝试获取最近七天内状态从"created"变为"in progress"的所有工作项。
这是我的当前查询:
"type:arbeitspaket and updated:[$today-7d$ TO $today$] AND status:inBearbeitung"
是否可能仅获取状态字段从"created"更新到"in progress"的工作项?
英文:
im trying to get all work items whose status has changed from "created" to "in progress" in the last seven days.
This is my current query:
"type:arbeitspaket and updated:[$today-7d$ TO $today$] AND status:inBearbeitung"
Is it possible to get work itemes where only the status field updated from "created" to "in progress"?
答案1
得分: 0
Polarion不支持查询历史数据。因此,无法通过Lucene查询询问Polarion 何时字段更改其值。
您可以通过API搜索历史记录,但这可能会导致性能问题:API将始终返回相关项目的完整历史记录。如果有10000次提交,您将在列表中收到10000个条目(需要进行搜索)。
不过,对于状态更改,有一种简单的解决方法:您可以使用工作流操作自动填充日期和先前状态(或其他内容)到隐藏的自定义字段中。然后,您可以查询这些字段。
有一个名为Changed Field的内置功能,可以在此处找到文档记录日期。
英文:
Polarion does not support queries to historical data. So it is not possible to ask Polarion via Lucene-query when a field changed its value.
You can search through history via API, but this is a potential performance hole: The API will always return the complete history of the item in question. If you have 10000 commits on it, you will receive 10000 entries in a list (which you need to search through).
However, for status changes there is an easy workaround: you can use the workflow actions to auto-fill dates and previous states (or anything else) into hidden custom fields. Then you can query those fields.
There is a build-in function called Changed Field documented here to record the date.
答案2
得分: 0
以下脚本演示了如何检索历史记录
Velocity API
#set($modifiedWIinLastdays = $trackerService.queryWorkItems("updated:[$today-7d$ TO $today$]", "id" )
#set($ignoreFields = [<<type in all custom field ids expect status>>])
#foreach($workItem in $modifiedWIinLastdays)
#set($workItemHistory = $workItem.getDataSvc().getDiffManager().generateHistory($workItem, $ignoredFields))
#foreach ($change in $workItemHistory)
#set ($diffs = $change.getDiffs())
#foreach ($diff in $diffs)
#if ($diff.getFieldName().equals("status"))
#if ($diff.getAfter().getId().equals("inProgress"))
<<your result>>
#end
#end
#end
#end
(Note: The code remains unchanged, as requested.)
英文:
Below script shows how to retrieve the history
Velocity API
#set($modifiedWIinLastdays = $trackerService.queryWorkItems("updated:[$today-7d$ TO $today$]", "id" )
#set($ignoreFields =[<<type in all custom field ids expect status>>])
#foreach($workItem in $modifiedWIinLastdays)
#set($workItemHistory=$workItem.getDataSvc().getDiffManager().generateHistory($workItem, $ignoredFields))
#foreach ($change in $workItemHistory)
#set ($diffs = $change.getDiffs())
#foreach ($diff in $diffs)
#if ($diff.getFieldName().equals("status"))
#if ($diff.getAfter().getId().equals("inProgress"))
<<your result>>
#end
#end
#end
#end
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论