Counts on the server side via WSAPI? - rally

Is it possible to do object counts on the server side of Rally with the WSAPI?
For example, I've got an app that would like to count the number of unresolved defects for each project in our workspace. I don't need to know anything about those defects themselves, so I just want a count, and don't need any other data pulled back.
Any way to do this?

You might want to check out Alan's helpful answer to this Question:
Rally: Pull stories counts by schedule state for a release?
The analog for Defects would be:
https://rally1.rallydev.com/slm/webservice/1.31/defect.js?query=(State < "Fixed")
It does pull all the data, but you can grab the TotalResultCount attribute that is returned in the response to get the number of Defects matching your query.

Related

How can I pull all work items currently or previously associated with a Sprint in Azure DevOps

I am attempting to retrieve all work items currently or previously associated with a given Iteration from Azure DevOps, either through an in-system query or through the API. I need this information to calculate sprint predictability metrics.
As far as I can tell, ADO only stores the latest Iteration in the work items fields, so the API call to ask for tickets associated with a Past iteration does not include any tickets that may have been moved to a different iteration mid-sprint. Likewise, they query options do not allow for something like a "was" operator to test for work items with may have met the criteria in the past.
Short of pulling each work item history individually through the API and creating my own iteration timeline for all tickets in the system, how can I get this information?
Take a look at this. You have to use the "was ever" operator in the iteration path. To do so, you have to query for it using the WIQL-Syntax.
So you'll have to add
...
AND (
EVER (
[System.IterationPath] = #currentIteration('[YourTeam]\... <id:...>'))
to the WHERE part of the query.
If you want to see an extended example, look here

TFS2015 - List how many times tags were used in TFS 2015 On-Premise work items

​Hello,
​I am trying to write an SQL query to list all tags along with the number of how many times they were used in Work Items in TFS2015.
I cannot find the connection between tbl_WorkItemCoreLatest, tbl_PropertyDefinition and tbl_TagDefinition that would point me to tags used on work items.
I tried to go with the solution from here, but with no success. The query results seems not to match what I see directly in VSTS (eg. searching for a particular tag returns me work items from which some don't have that particular tag, almost as if TFS would store previous states of work items...?)
If there's a way to do that with REST API, that will work as well.
Any help will be much appreciated.
You can use TFS REST API below to get all work items with System.Tags field, then calculate how many times they were used:
`http://tfs2015:8080/tfs/DefaultCollection/teamproject/_apis/wit/reporting/workitemrevisions?fields=System.Tags&includeLatestOnly=true&api-version=2`
Another simple way is creating a work item query with Tags column and open this query in Excel to filter the Tags column.

Cross-project time-record filtering using Active Collab 5 API

For Active Collab team watching this tag.
I am working on a project that uses new Active Collab 5 API, I am having performance issue trying to run reports.
Example I try to build reports on date-range, and currently to achieve that I need to first run a call to get all projects.
Followed by a loop with this call:
API::get('/projects/'.$id.'/time-records/filtered-by-date?' . http_build_query(['from' => $from, 'to' => $to]))
However we have a large number of projects, in addition to high number of active projects we also need to filter Archived projects as well to get correct reports for billing.
Now I work with around 1500 projects in AC.
So I need to make 1500 API calls which takes a huge performance hit. Is there a way that you can possibly build something that would work along these lines.
API::get(/timerecords/filter-by-date);
with a possible passed parameter that will say (all, active, complited) project state.
Please let me know what you can do or if I have missed something in your documentation that already does this.
Thanks
What you need here is not a request that goes through all projects one by one, but a request that it tailored for cross-project reporting. Active Collab 5 has just the right API endpoint for that - /reports/run.
As an example, you can use this command to query time records and expenses from all active projects that were tracked today:
curl -H "X-Angie-AuthApiToken: YOUR-API-TOKEN" "http://your.activecollab.com/api/v1/reports/run?type=TrackingFilter&project_filter=active&tracked_on_filter=today"
Notice the route (/reports/run) and query arguments:
type - specify type of the report, in this case time and expense tracking report,
project_filter - specify project filter. Apart from active, other useful values of this filter are completed (for completed projects), selected_1,2,3,4 (selected projects with a list of project ID-s), client_1,2,3,4 (projects for clients with the given ID-s), category_1,2,3,4 (projects in categories with the given ID-s),
tracked_on_filter - filter by the date when records were tracked. To target a particular date use selected_date_YYYY-MM-DD and to target a date range use selected_range_YYYY-MM-DD:YYYY-MM-DD.
tracked_by_filter - filter by who tracked the time. It can have various values, like anybody, logged_user, selected_1,2,3.
To list only time records, set type_filter to time (or to expenses if you want only expenses to be listed).

hiding unnecessary fields in Access Report

At my workplace there is a "Daily Feedback" database where details are entered of any errors made by Customer Service Officers (CSOs), such as who made the mistake, when, and what service it was for. this is so we can gather data which would show areas where CSO's are repeatedly making mistakes so we can feed this back to them and train them in those areas if need be.
i currently have a report where an CSOs name is entered along with a date range and it produces the report showing the number of errors made for each service for that date range.
the code used is -
=Sum(IIf([Service]="Housing",1,0))
=Sum(IIf([Service]="Environmental Health",1,0))
etc etc for each Service.
The problem i have is that not every CSO does EVERY service and so there are usually a few results showing as "0". and i cannot be sure if thats because they dont do the service or if they are just very good at that service.
Being absolutely useless at SQL (or any other possible way of fixing this) i cannot figure out how to HIDE the entries that produce the zero value.
any help here would be greatly appreciated!
Assuming you have a table with the fields CSO, Service, FeedbackComments you could modify the report record source to
SELECT [CSO], [Service], Count([FeedbackComments])
FROM [FeedbackTable]
GROUP BY [CSO], [Service];
Then services which have no records will not appear on the report.
I don't understand exactly what you want. But I want to mention you can use the COUNT() function along with SUM(). A count >0 will reveal if 0 means '0' instances or '0' errors.

Selecting specific joined record from findAll() with a hasMany() include

(I tried posting this to the CFWheels Google Group (twice), but for some reason my message never appears. Is that list moderated?)
Here's my problem: I'm working on a social networking app in CF on Wheels, not too dissimilar from the one we're all familiar with in Chris Peters's awesome tutorials. In mine, though, I'm required to display the most recent status message in the user directory. I've got a User model with hasMany("statuses") and a Status model with belongsTo("user"). So here's the code I started with:
users = model("user").findAll(include="userprofile, statuses");
This of course returns one record for every status message in the statuses table. Massive overkill. So next I try:
users = model("user").findAll(include="userprofile, statuses", group="users.id");
Getting closer, but now we're getting the first status record for each user (the lowest status.id), when I want to select for the most recent status. I think in straight SQL I would use a subquery to reorder the statuses first, but that's not available to me in the Wheels ORM. So is there another clean way to achieve this, or will I have to drag a huge query result or object the statuses into my CFML and then filter them out while I loop?
You can grab the most recent status using a calculated property:
// models/User.cfc
function init() {
property(
name="mostRecentStatusMessage",
sql="SELECT message FROM statuses WHERE userid = users.id ORDER BY createdat DESC LIMIT 1,1"
);
}
Of course, the syntax of the SELECT statement will depend on your RDBMS, but that should get you started.
The downside is that you'll need to create a calculated property for each column that you need available in your query.
The other option is to create a method in your model and write custom SQL in <cfquery> tags. That way is perfectly valid as well.
I don't know your exact DB schema, but shouldn't your findAll() look more like something such as this:
statuses = model("status").findAll(include="userprofile(user)", where="userid = users.id");
That should get all statuses from a specific user...or is it that you need it for all users? I'm finding your question a little tricky to work out. What is it you're exactly trying to get returned?