I’m trying to create a Rally Javascript API app to break down defects reported within a release cycle into “current” and “prior”. Current = defects against stories in the selected release. Prior = defects against stories in a prior release or with no associated story. In both cases, the defect creation date must be within the date range of the release.
Here’s the basic flow I was going for:
- Select a release
- Query all defects where CreationDate is within the selected release date range
- If the defect has a Requirement and the Requirement is in the selected release, count as “current”, otherwise count as “prior”
It seemed simple enough, but I’ve run into a roadblock in determining if the defect is reported against a story in the selected release or not. Defects have a Requirement property which represents the story the defect is against, but the Requirement object does not have a Release property. Only HierarchicalRequirement has a Release property.
Any thoughts on how to determine the release of a requirement on a defect? Or maybe a different approach that could accomplish the same thing?
Per request for a code snippet:
I started with the Defects by Closer app from the catalog since it had the basic layout I wanted and just modified the query and table population logic.
Here’s the query:
var relDateBeg = rally.sdk.util.DateTime.toIsoString(new Date(releaseDropdown.getSelectedStart()));
var relDateEnd = rally.sdk.util.DateTime.toIsoString(new Date(releaseDropdown.getSelectedEnd()));
var queryCriteria = '((CreationDate >= ' + relDateBeg + ') AND (CreationDate <= ' + relDateEnd + '))';
var queryConfig =
{
key : "defects",
type : "Defect",
fetch : "ObjectID,FormattedID,Name,ClosedDate,Requirement,CreationDate",
order : "FormattedID",
query : queryCriteria
};
Then in the showResults() method that processes the query results, I iterate through all the defects and populate the table. In this code I check if the defect has a Requirement, and if so, I wanted to check what release the Requirement belongs to so I could categorize the defect as “current” or “prior”, but the Requirement object doesn’t have a Release property.
Add Release to your fetch. That should include the release in the results for each defect and linked story.