查找过去 30 天内分配给 X 的工作项

发布于 2024-10-20 02:50:55 字数 276 浏览 2 评论 0原文

我正在尝试查找过去 30 天内分配给人员 X 的所有工作项。
我遇到的大问题是“过去 30 天”部分。

我考虑过使用“ever”或“asof”关键字,但还找不到一个好的答案..类似于 WHERE [Assigned To] = 'X' AND (([Assigned To] != 'X ') asof '<30daysago>')
但这仍然不是万无一失的解决方案。

还有更好的想法吗?

谢谢&亲切的问候

西蒙

I'm trying to find all WorkItems that were assigned to a person X in the last 30 days.
The big problem I have is the "in the last 30 days"-part.

I thought about using the "ever" or "asof" keywords, but couldn't find a good answer yet.. something like WHERE [Assigned To] = 'X' AND (([Assigned To] != 'X') asof '<30daysago>').
But this is still not a bulletproof solution.

Any better ideas?

Thanks & kind regards

Simon

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自找没趣 2024-10-27 02:50:55

看来仅使用 WIQL 是不可能的,但您可以接近。

关键字@Today将为您提供今天的日期,然后从中减去您的范围即可。您需要将 EVER 关键字应用于 [Status]='AssignedTo' 并与过去 30 天的日期与 [StateChangeDate] 进行比较。

尽可能接近 WIQL 和现有字段
这表示,从所有修订(状态更改)中返回用户“X”曾被分配到且状态在过去 30 天内发生更改的记录。这基本上会让您对用户上个月的工作情况有一个稍微模糊的了解。

WHERE [Microsoft.VSTS.Common.StateChangeDate] >= @today - 30  
  AND  [System.AssignedTo] EVER 'Bennett Aaron' 
    ORDER BY [System.State]

添加缺失的字段
您可以添加一个名为“AssignedDate”的自定义字段,该字段是在您在工作项定义 XML 中创建的“New->AssignedTo”工作流转换期间捕获的。您可以使用 Visual Studio 的 Team Foundation Server Power Tools 扩展来完成此任务。这将为您提供所需的信息以及未来的其他报告选项。

TFS API
我无法帮助您解决这个问题,但我相信您可以使用 TFS API 进行查询。

我在 ASOF 和 EVER 上遇到的一些快速问题可以帮助您节省时间:

AsOf 本身不会帮助您解决此问题,因为它不支持日期范围。它允许您像另一个日期一样进行查询。换句话说,如果您忘记捕获昨天的查询结果,则可以使用 AsOf 查询来获取昨天运行该查询时会获得的结果。我的理解是你想查询一个基本的日期范围。

EVER 可能无法按照您对日期的预期工作,因为我相信它使用它测试的字段的确切值(将包含日期字段的时间戳部分)。只需确保 EVER 关键字用于状态字段而不是日期。

It appears that this is not possible using just WIQL, but you can get close.

The keyword @Today will give you today's date, then just subtract your range from it. The EVER keyword applied to [Status]='AssignedTo' and a comparison against a date 30 days in the past to [StateChangeDate] is what you'll need to accomplish this.

As close as you can get with WIQL and existing fields:
This says, from all revisions (status changes) return records where the user 'X' has ever been AssignedTo and the State has changed in the last 30 days. This will basically give you a slightly fuzzy picture of what your User has been working on in the last month.

WHERE [Microsoft.VSTS.Common.StateChangeDate] >= @today - 30  
  AND  [System.AssignedTo] EVER 'Bennett Aaron' 
    ORDER BY [System.State]

Add the missing field:
You could add a custom field called AssignedDate that is captured during the New->AssignedTo workflow transition that you create in the Work Item Definition XML. You can accomplish this using the Team Foundation Server Power Tools extension to Visual Studio. This would give you exactly what you need as well as additional reporting options going forward.

TFS API
I cannot help you with this one, but I believe you could query using the TFS API.

A couple of quick gotchas I've experienced to save you time on ASOF and EVER:

AsOf won't help you by itself with this as it does not support a range of dates. It allows you to query as if it were another date. In other words, if you forgot to capture the results of a query yesterday, you can use an AsOf query to get the results that you would have gotten had it run yesterday. What I understand is that you want to query a basic date range.

EVER might not work as you expect against dates as I believe it uses the exact value of the field (timestamp portion of the date field would be included) it tests with. Just make sure the EVER keyword is used against the status field rather than a date.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文